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;
每天进步一点点