hive lateral view explode 使用

来源:互联网 发布:排序算法对比 编辑:程序博客网 时间:2024/05/19 23:12
         select
                SUPER_SITE_ID,
                split(tmp.cmapaign,',')[0] as SUPER_CMAPAIGN_ID ,
                split(tmp.cmapaign,',')[2] as SUPER_POSITION   
         from (           
         
                select
                        SUPER_SITE_ID ,
                        cmapaign
                from    cjfImprLog lateral view explode(split(super_cmapaign,'\\;')) cmapaign1 ascmapaign    
                where   yyyymmdd='${yyyymmdd}' and SUPER_TYPE =1 and  super_cmapaign <> ''
                

         ) tmp  

  红色部分必须要写,否则不会出现列转行的结果。

  绿色部分要注意转义符号

0 0
原创粉丝点击