I have to change the schema of a ORC file. The ORC is kept on an adls location.
The original schema in orc file is
Old Schema Column headers : (C1 , C2 , C3 , C4 )
I want to overide original schema with the new schema (created from StructType and StructField.)
New Schema Column headers : (Name , Age , Sex , Time)
The spark command i am using is : val df2 = spark.read.format("orc").schema(schema).load("path/")
as soon as i run df2.show(2,false)
The data for all the columns become null.
When i do not override the already present old schema and run
val df2 = spark.read.format("orc").load("path/")
i get the data but the column headers are C1, C2 , C3 and C4.
Could you please tell me how to read data in the new schema and why it is not working ?
Thank you in advance.