[ https://issues.apache.org/jira/browse/HIVE-24797?focusedWorklogId=554692&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-554692 ]
ASF GitHub Bot logged work on HIVE-24797: ----------------------------------------- Author: ASF GitHub Bot Created on: 19/Feb/21 10:16 Start Date: 19/Feb/21 10:16 Worklog Time Spent: 10m Work Description: wangyum opened a new pull request #1994: URL: https://github.com/apache/hive/pull/1994 ### What changes were proposed in this pull request? This pr disable validate default values when parsing Avro schemas. ### Why are the changes needed? It will throw exception when upgrading Avro to 1.10.1 for this schema:: ``` { "type": "record", "name": "EventData", "doc": "event data", "fields": [ {"name": "ARRAY_WITH_DEFAULT", "type": {"type": "array", "items": "string"}, "default": null } ] } ``` ``` org.apache.avro.AvroTypeException: Invalid default for field USERACTIONS: null not a {"type":"array","items":"string"} at org.apache.avro.Schema.validateDefault(Schema.java:1571) at org.apache.avro.Schema.access$500(Schema.java:87) at org.apache.avro.Schema$Field.<init>(Schema.java:544) at org.apache.avro.Schema.parse(Schema.java:1678) at org.apache.avro.Schema$Parser.parse(Schema.java:1425) at org.apache.avro.Schema$Parser.parse(Schema.java:1396) at org.apache.hadoop.hive.serde2.avro.AvroSerdeUtils.getSchemaFor(AvroSerdeUtils.java:287) at org.apache.hadoop.hive.serde2.avro.AvroSerdeUtils.getSchemaFromFS(AvroSerdeUtils.java:170) at org.apache.hadoop.hive.serde2.avro.AvroSerdeUtils.determineSchemaOrThrowException(AvroSerdeUtils.java:139) at org.apache.hadoop.hive.serde2.avro.AvroSerDe.determineSchemaOrReturnErrorSchema(AvroSerDe.java:187) at org.apache.hadoop.hive.serde2.avro.AvroSerDe.initialize(AvroSerDe.java:107) at org.apache.hadoop.hive.serde2.avro.AvroSerDe.initialize(AvroSerDe.java:83) at org.apache.hadoop.hive.serde2.SerDeUtils.initializeSerDe(SerDeUtils.java:533) at org.apache.hadoop.hive.metastore.MetaStoreUtils.getDeserializer(MetaStoreUtils.java:493) at org.apache.hadoop.hive.ql.metadata.Partition.getDeserializer(Partition.java:225) ``` Related Avro ticket: https://issues.apache.org/jira/browse/AVRO-2035 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Manual test. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 554692) Remaining Estimate: 0h Time Spent: 10m > Disable validate default values when parsing Avro schemas > --------------------------------------------------------- > > Key: HIVE-24797 > URL: https://issues.apache.org/jira/browse/HIVE-24797 > Project: Hive > Issue Type: Bug > Reporter: Yuming Wang > Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > It will throw exceptions when upgrading Avro to 1.10.1 for this schema: > {code:json} > { > "type": "record", > "name": "EventData", > "doc": "event data", > "fields": [ > {"name": "ARRAY_WITH_DEFAULT", "type": {"type": "array", "items": > "string"}, "default": null } > ] > } > {code} > {noformat} > org.apache.avro.AvroTypeException: Invalid default for field USERACTIONS: > null not a {"type":"array","items":"string"} > at org.apache.avro.Schema.validateDefault(Schema.java:1571) > at org.apache.avro.Schema.access$500(Schema.java:87) > at org.apache.avro.Schema$Field.<init>(Schema.java:544) > at org.apache.avro.Schema.parse(Schema.java:1678) > at org.apache.avro.Schema$Parser.parse(Schema.java:1425) > at org.apache.avro.Schema$Parser.parse(Schema.java:1396) > at > org.apache.hadoop.hive.serde2.avro.AvroSerdeUtils.getSchemaFor(AvroSerdeUtils.java:287) > at > org.apache.hadoop.hive.serde2.avro.AvroSerdeUtils.getSchemaFromFS(AvroSerdeUtils.java:170) > at > org.apache.hadoop.hive.serde2.avro.AvroSerdeUtils.determineSchemaOrThrowException(AvroSerdeUtils.java:139) > at > org.apache.hadoop.hive.serde2.avro.AvroSerDe.determineSchemaOrReturnErrorSchema(AvroSerDe.java:187) > at > org.apache.hadoop.hive.serde2.avro.AvroSerDe.initialize(AvroSerDe.java:107) > at > org.apache.hadoop.hive.serde2.avro.AvroSerDe.initialize(AvroSerDe.java:83) > at > org.apache.hadoop.hive.serde2.SerDeUtils.initializeSerDe(SerDeUtils.java:533) > at > org.apache.hadoop.hive.metastore.MetaStoreUtils.getDeserializer(MetaStoreUtils.java:493) > at > org.apache.hadoop.hive.ql.metadata.Partition.getDeserializer(Partition.java:225) > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)