标签:style blog http io ar os sp on 2014
执行如下hive sql:
select * from trackinfo where ds=$date and session_id in (select session_id from rcmd_track_path where ds=$date and add_cart_flag>0 and product_id>0);</span>
FAILED: ParseException line 2:39 cannot recognize input near 'select' 'session_id' 'from' in expression specification
hive不支持in 子查询的用法,可以考虑用left semi join的方式来替换in,对上面的hive sql改写如下:
select * from trackinfo t1 left semi join rcmd_track_path t2 on (t1.session_id=t2.session_id and t2.add_cart_flag>0 and t2.product_id>0 and t1.ds=$date and t2.ds=$date);
标签:style blog http io ar os sp on 2014
原文地址:http://blog.csdn.net/yeweiouyang/article/details/41645315