79488444

Date: 2025-03-06 06:38:37
Score: 1
Natty:
Report link

Following transformation helped:

val renamedDf = backfillDf.withColumnRenamed("pf", "data").withColumnRenamed("cid", "profileId")

val cstColsSeq = renamedDf.columns.filter(c => c.endsWith("data")).map(f => { col(f) }).toSeq
var cstMapCol: Column = org.apache.spark.sql.functions.struct(cstColsSeq: _*)
renamedDf.withColumn("profile", cstMapCol).drop("data").printSchema
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Sadhna Jain