MyException - 我的异常网
当前位置:我的异常网» 数据库 » Hive批量插入分区表时报java.lang.ClassCastExcepti

Hive批量插入分区表时报java.lang.ClassCastException解决方法

www.MyException.Cn  网友分享于:2013-02-21  浏览:144次
Hive批量插入分区表时报java.lang.ClassCastException解决办法

将从一个表查询结果插入到一个分区表时,有时会在Load data步骤出错,这是在执行语句前没切换到目标表所在的库导致。

所以在执行插入语句前,先用use databasename切换到目标表所在的库下就正常了。

——————————以下是出错语句示例————————————

$ hive
Logging initialized using configuration in jar:file:/data/opt/hive-0.8.1/lib/hive-common-0.8.1.jar!/hive-log4j.properties
Hive history file=/tmp/hadoop/hive_job_log_hadoop_201302171019_1202642080.txt

hive> INSERT OVERWRITE TABLE dw1.t_test PARTITION(f_day)
    >     SELECT f_prod_id, f_uuid_prod, f_uuid_channel, f_uuid, f_cost, f_day
    >     FROM dw0.t_test
    >     WHERE f_day >= '2013-02-02' and f_day<= '2013-02-03'
    >     DISTRIBUTE BY f_day;
Total MapReduce jobs = 1
Launching Job 1 out of 1
Number of reduce tasks not specified. Estimated from input data size: 1
In order to change the average load for a reducer (in bytes):
  set hive.exec.reducers.bytes.per.reducer=<number>
In order to limit the maximum number of reducers:
  set hive.exec.reducers.max=<number>
In order to set a constant number of reducers:
  set mapred.reduce.tasks=<number>
Starting Job = job_201206261006_347586, Tracking URL = http://master:50030/jobdetails.jsp?jobid=job_201206261006_347586
Kill Command = /data/opt/hadoop/bin/hadoop job  -Dmapred.job.tracker=master:9001 -kill job_201206261006_347586
Hadoop job information for Stage-1: number of mappers: 13; number of reducers: 1
2013-02-17 14:03:37,377 Stage-1 map = 0%,  reduce = 0%
2013-02-17 14:03:39,396 Stage-1 map = 8%,  reduce = 0%, Cumulative CPU 1.21 sec
2013-02-17 14:03:40,405 Stage-1 map = 54%,  reduce = 0%, Cumulative CPU 12.34 sec
2013-02-17 14:03:41,412 Stage-1 map = 92%,  reduce = 0%, Cumulative CPU 26.6 sec
2013-02-17 14:03:42,419 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 29.29 sec
2013-02-17 14:03:43,426 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 29.29 sec
2013-02-17 14:03:44,433 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 29.29 sec
2013-02-17 14:03:45,440 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 29.29 sec
2013-02-17 14:03:46,447 Stage-1 map = 100%,  reduce = 33%, Cumulative CPU 29.29 sec
2013-02-17 14:03:47,455 Stage-1 map = 100%,  reduce = 100%, Cumulative CPU 31.7 sec
2013-02-17 14:03:48,462 Stage-1 map = 100%,  reduce = 100%, Cumulative CPU 31.7 sec
MapReduce Total cumulative CPU time: 31 seconds 700 msec
Ended Job = job_201206261006_347586
Loading data to table dw1.t_test partition (f_day=null)
Deleted hdfs://master/data/dw1/test/f_day=20130202
Failed with exception java.lang.ClassCastException: org.apache.hadoop.hive.metastore.api.InvalidOperationException cannot be cast to java.lang.RuntimeException
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask
MapReduce Jobs Launched:
Job 0: Map: 13  Reduce: 1   Accumulative CPU: 31.7 sec   HDFS Read: 71311348 HDFS Write: 14213 SUCESS
Total MapReduce CPU Time Spent: 31 seconds 700 msec

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有