Re: Create static Map Type column

2017-07-26 Thread ayan guha
never mind, found the solution. Spark 2.0 + val df1 = df.withColumn("newcol",map(lit("field1"),lit("fieldName1"))) scala> df1.show() +---++ | a| newcol| +---++ | 1|Map(field1 -> fie...| | 2|Map(field1 -> fie...| | 3|Map(field1 -> fie...| |

Create static Map Type column

2017-07-26 Thread ayan guha
Hi I want to create a static Map Type column to a dataframe. How I am doing now: val fieldList = spark.sparkContext.parallelize(Array(Row(Map("field1" -> "someField" val fieldListSchemaBase = new StructType() val f = StructField("encrypted_field_list",MapType(StringType,S