I am trying to add a new column using withcolumn whose value should be NULL but its not working.
val schema = StructType(
StructField("uid",StringType,true)::
StructField("sid",StringType,true)::
StructField("astid",StringType,true)::
StructField("timestamp",StringType,true)::
StructField("start",StringType,true)::
StructField("end",StringType,true)::
StructField("geo",StringType,true)::
StructField("stnid",StringType,true)::
StructField("end_type",LongType,true)::
StructField("like",LongType,true)::
StructField("dislike",LongType,true)::Nil
)
val Mobpath = spark.read.schema(schema).csv("/data/mob.txt")
Mobpath.printSchema()
Mobpath.createOrReplaceTempView("Mobpathsql")
val showall = spark.sql("select * from Mobpathsql")
showall.show()
val newcol = Mobpath.withColumn("new1",functions.lit("null"))
newcol.show()
using withcolumn
it is not showing any error and also not showing any output.