I am trying this:
val sensorsDf = Seq(
("sensor1", 26, 30, 1000),
("sensor2", 25, 30, 1100),
("sensor3", 26, 30, 1000)
).toDF("sensor", "temperature", "humidity", "brightness")
val sensors2Df = sensorsDf.withColumn("measures", Map("temperature" -> col("temperature"), "humidity" -> col("humidity"), "brightness" -> col("brightness")))
But I get an exception:
error: type mismatch; found : scala.collection.immutable.Map[String,org.apache.spark.sql.Column] required: org.apache.spark.sql.Column
Is it possible to this?