Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-24797

Disable validate default values when parsing Avro schemas

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      It will throw exceptions 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 ARRAY_WITH_DEFAULT: 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)
      

      Attachments

        Issue Links

          Activity

            People

              yumwang Yuming Wang
              yumwang Yuming Wang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 4h
                  4h