在hive升级到1.1.后,有case when的hql报错:FAILED: IndexOutOfBoundsException Index: 2, Size:
hive (default)> select (case when amt>100 then 1 end) from tmp.test;
FAILED: IndexOutOfBoundsException Index: 2, Size: 2
解决方法为,增加else null。
hive (default)> select (case when amt>100 then 1 else null end) from tmp.test;
Query ID = hadoop_20160604135353_7c5d4e93-8fc8-4da1-b142-de323fb12bc5
Total 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_1464680717477_18142, Tracking URL = http://pmaster3:8088/proxy/application_1464680717477_18142/
Kill Command = /usr/local/hadoop/bin/hadoop job -kill job_1464680717477_18142
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0
2016-06-04 14:02:03,285 Stage-1 map = 0%, reduce = 0%
2016-06-04 14:02:08,491 Stage-1 map = 100%, reduce = 0%, Cumulative CPU 3.1 sec
MapReduce Total cumulative CPU time: 3 seconds 100 msec
Ended Job = job_1464680717477_18142
MapReduce Jobs Launched:
Stage-Stage-1: Map: 1 Cumulative CPU: 3.1 sec HDFS Read: 3304 HDFS Write: 2 SUCCESS
Total MapReduce CPU Time Spent: 3 seconds 100 msec
OK
_c0
1
Time taken: 12.057 seconds, Fetched: 1 row(s)