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
Not sure about pig, but in spark, you could do this with a one-line command
df.groupBy("Id").pivot("Name").agg(first("Value"))