Pivoting in Pig

后端 未结 2 1923
说谎
说谎 2020-12-06 03:48

This is related to the question in Pivot table with Apache Pig. I have the input data as

Id    Name     Value 
1     Column1  Row11 
1     Column2  Row12 
1          


        
2条回答
  •  不知归路
    2020-12-06 04:24

    Not sure about pig, but in spark, you could do this with a one-line command

    df.groupBy("Id").pivot("Name").agg(first("Value"))
    

提交回复
热议问题