Details
Description
Please find below the procedure we followed to create avro file using spark.
1.Created JSON file for the schema available in table
2.Created List with JSON file
3.Created avro StructField by looping the above list using below code
fields.add(DataTypes.createStructField(field.name().toLowerCase(),getDataTypeForAvro(field.schema()), true));
Issue:
If the data type is numeric type(decimal or int) it is not accepting null value
error message:
Caused by: org.apache.avro.file.DataFileWriter$AppendWriteException: org.apache.avro.UnresolvedUnionException: Not in union ["double","null"]: