日期:2014-05-16  浏览次数:20452 次

hive void类型

hive文档中(http://blog.csdn.net/yfkiss/article/details/7752180)没有说明一种类型叫做void

但是,void类型确真实存在,并且,对有void类型的表的访问会引发一些问题!


如下:
> select * from a;
OK
NULL    NULL
1       NULL


> CREATE TABLE test 
> AS 
> SELECT a.key, a.value, NULL  AS tmp
> FROM a;

.....

> DESC test;                                                     
OK
key     int
value   string
tmp     void

> select * from test;                                            
OK
Failed with exception java.io.IOException:java.lang.RuntimeException: Internal error: no LazyObject for VOID
Time taken: 0.075 seconds
 
若查询不涉及void字段,更糟,会造成运行时错误,错误更难发现!
> select key from test;
Total MapReduce jobs = 1
Launching Job 1 out of 1
Number of reduce tasks is set to 0 since there's no reduce operator
Starting Job = job_201301101933_0010, Tracking URL = http://localhost:50030/jobdetails.jsp?jobid=job_201301101933_0010
Kill Command = /home/work/hadoop/hadoop-1.0.3/libexec/../bin/hadoop job  -Dmapred.job.tracker=localhost:9001 -kill job_201301101933_0010
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0
2013-01-13 18:53:38,497 Stage-1 map = 0%,  reduce = 0%
2013-01-13 18:54:08,651 Stage-1 map = 100%,  reduce = 100%
Ended Job = job_201301101933_0010 with errors
Error during job, obtaining debugging information...
Examining task ID: task_201301101933_0010_m_000002 (and more) from job job_201301101933_0010
Exception in thread "Thread-73" java.lang.RuntimeException: Error while reading from task log url
        at org.apache.hadoop.hive.ql.exec.errors.TaskLogProcessor.getErrors(TaskLogProcessor.java:130)
        at org.apache.hadoop.hive.ql.exec.JobDebugger.showJobFailDebugInfo(JobDebugger.java:211)
        at org.apache.hadoop.hive.ql.exec.JobDebugger.run(JobDebugger.java:81)
        at java.lang.Thread.run(Thread.java:679)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: http://ubuntu:50060/tasklog?taskid=attempt_201301101933_0010_m_000000_1&start=-8193
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1403)
        at java.net.URL.openStream(URL.java:1029)
        at org.apache.hadoop.hive.ql.exec.errors.TaskLogProcessor.getErrors(TaskLogProcessor.java:120)
        ... 3 more
FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask
MapReduce Jobs Launched: 
Job 0: Map: 1   HDFS Read: 0 HDFS Write: 0 FAIL
Total MapReduce CPU Time Spent: 0 msec