I am reading a parquet file like this using Java Spark
Dataset<MyData> myDataDS = sparkSession.read().parquet(myParquetFile)
.as(Encoders.bean(MyData.class));
It worked fine if myParquetFile schema is exactly according to the class MyData however let's say if I add a new field e.g. myId (even though it's value is null) to MyData class then I need to regenerate the parquet file otherwise it will throw the exception like
Caused by: org.apache.spark.sql.AnalysisException: No such struct field myId
Is there a way I can skip the null values to get pass this error without regenerating the parquet file?