1. hive表中有一列值,是以 分號 ; 為分隔符連接存儲的
1470047164;1470047628;1470049068;1470048978;1470048922;1470047658;1470047628;1470047628;1470047778;
2. 使用sql語句在HUE里面直接以 ; 分隔查詢並無異常。
select test.thedate ,time_stamp1 from ( select thedate ,time_stamp from my_table where dt='2016-08-10' )test lateral view explode(split(time_stamp,';')) t as time_stamp1 limit 10;
3. 但是,在把腳本保存后,oozie自動化執行時卻報很奇怪的錯誤:
Error: Error while compiling statement: FAILED: ParseException line 23:39 cannot recognize input near '<EOF>' '<EOF>' '<EOF>' in select expression (state=42000,code=40000)
4. 搜索了一下,發現問題的根源竟然是分號!!
分號是 SQL的結束符,在HDFS里識別並不智能,HQL直接識別為 EOF.
解決方法: 用分號的二進制 073來代替即可。
select test.thedate ,time_stamp1 from ( select thedate ,time_stamp from my_table where dt='2016-08-10' )test lateral view explode(split(time_stamp,'\073')) t as time_stamp1 limit 10;