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

Empty Avro schema when defined by avro.schema.url

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.0.0-alpha-1, 4.0.0-alpha-2
    • None
    • kafka integration
    • None

    Description

      When I try to create Kafka table with Avro Confluent schema defined by avro.schema.url I get following error:

      java.lang.IllegalArgumentException: Avro Schema is empty Can not go further
              at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122) ~[guava-19.0.jar:?]
              at org.apache.hadoop.hive.kafka.KafkaSerDe.initialize(KafkaSerDe.java:133) ~[kafka-handler-4.0.0-alpha-2-SNAPSHOT.jar:4.0.0-alpha-2-SNAPSHOT]
      ... 

      However if schema is defined by avro.schema.literal property everything works fine.

      I think that bug is caused by this expression in KafkaSerDe.initialize method:

      String schemaFromProperty = properties.getProperty(AvroSerdeUtils.AvroTableProperties.SCHEMA_LITERAL.getPropName(), ""); 

      The schema literal value should be read from tableProperties instead of properties attribute, because AvroSerDe object write parsed schema to tableProperties object before.

      So the fixed expression should look as follows:

      String schemaFromProperty = tableProperties.getProperty(AvroSerdeUtils.AvroTableProperties.SCHEMA_LITERAL.getPropName(), ""); 

      Attachments

        Activity

          People

            Unassigned Unassigned
            martinbudinsky3 Martin Budinský
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: