Hive Explode / Lateral View multiple arrays

后端 未结 5 939
刺人心
刺人心 2020-11-30 02:23

I have a hive table with the following schema:

COOKIE  | PRODUCT_ID | CAT_ID |    QTY    
1234123   [1,2,3]    [r,t,null]  [2,1,null]

How

5条回答
  •  借酒劲吻你
    2020-11-30 02:43

    If you are using Spark 2.4 in pyspark, use arrays_zip with posexplode:

    df = (df
        .withColumn('zipped', arrays_zip('col1', 'col2'))
        .select('id', posexplode('zipped')))
    

提交回复
热议问题