posexplode和explode的区别
备注:explode(x)和posexplode()均为炸裂函数,区别在于explode炸出一个值,posexplode不仅炸出一个值还附带索引号
举例:
select split(col1,",")[idx] as col1 ,type as col2 from test t lateral view posexplode(split(col2,",")) t1 as idx, type -- idx为list(split(col2,","))中对应的每个索引,另外一个list根据该索引取值,就能做到一一匹配
本文来自博客园,作者:数据驱动,转载请注明原文链接:https://www.cnblogs.com/shun7man/p/17586078.html