allow read old parquet file which is maked by old api with old avro version which allow wrong default value in schema#1140
Conversation
…ersion which allow wrong default value in schema
|
Thanks @wwang-talend for opening the PR! Could you create a JIRA issue for this? |
| } else if (keyValueMetaData.get(AVRO_SCHEMA_METADATA_KEY) != null) { | ||
| // use the Avro schema from the file metadata if present | ||
| avroSchema = new Schema.Parser().parse(keyValueMetaData.get(AVRO_SCHEMA_METADATA_KEY)); | ||
| avroSchema = new Schema.Parser().setValidateDefaults(false).parse(keyValueMetaData.get(AVRO_SCHEMA_METADATA_KEY)); |
There was a problem hiding this comment.
Does this issue exist with both AVRO_SCHEMA_METADATA_KEY and OLD_AVRO_SCHEMA_METADATA_KEY?
There was a problem hiding this comment.
Blindly disabling validation at all times may introduce new issues silently. Is it safer to add a flag to work around this? In the default case, we should always enable validation.
There was a problem hiding this comment.
This does seem potentially scary - maybe it would be safest to make this a Configuration option that the user can opt into?
There was a problem hiding this comment.
+1 with option to enable this or not
|
This pull request has been automatically marked as stale because it has had no activity for at least 2 months. If you are still working on this change or plan to move it forward, please leave a comment or push a new commit so we know to keep it open. Otherwise, this PR will be closed automatically in about one month. Thank you for your contribution to Apache Parquet! |
Please consider if user call this api to write a parquet file with avro schema string in file metadata:
that "avroSchema" have wrong default value(as before avro 1.9, avro api not validate default value when construct avro schema).
Now user use new parquet-avro jar with avro 1.11.x, and do read action to read that old parquet file with avro schema string in file metadata, then will check the default value by parse avro schema in parquet AvroReadSupport, then issue will appear. That is why do this change here.
exception stack is this: