I am trying to create an empty dataFrame in Spark scala and wanted to create the schema of my own and load the record into it.
Below is the example
val emptyDf = spark.emptyDataFrame
val loadEmptyDf = emptyDf.withColumn("col1", lit("yes"), "col2", lit("no"))
but i am not able to get the default value which i am putting while creating schema
Current Output:
|col1|col2| | | |
expected Output:
|col1|col2| |yes | no |