I have a parquet file, which has - minus sign in its column name (i.e. student-name). I'm trying to use case class as an Encoder while reading the parquet file like below:
case class Student (student-name : String, student_age : String)
object abcd {
val student_details = spark.read.parquet('/path/to/parquet-file').as[Student]
}
But the problem is that minus sign - in the case class throwing errors. I have tried enclosing with backtick (`) it didn't help. please find the error list below.
Error without backtick
case class Student (student-name : String, student_age : String)
:expected
Wrong top statement declaration
Error with backtick
case class Student (`student-name` : String, student_age : String)
cannot resolve '`student$minusname`' given input columns:[student-name,student_age]
Any help would be greatly appreciated!
Thanks