Martin Budinský created HIVE-26333:
--------------------------------------
Summary: Empty Avro schema when defined by avro.schema.url
Key: HIVE-26333
URL: https://issues.apache.org/jira/browse/HIVE-26333
Project: Hive
Issue Type: Bug
Components: kafka integration
Affects Versions: 4.0.0-alpha-1, 4.0.0-alpha-2
Reporter: Martin Budinský
When I try to create Kafka table with Avro Confluent schema defined by
avro.schema.url I get following error:
{code:java}
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]
... {code}
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:
{code:java}
String schemaFromProperty =
properties.getProperty(AvroSerdeUtils.AvroTableProperties.SCHEMA_LITERAL.getPropName(),
""); {code}
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:
{code:java}
String schemaFromProperty =
tableProperties.getProperty(AvroSerdeUtils.AvroTableProperties.SCHEMA_LITERAL.getPropName(),
""); {code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)