Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
4.0.0-alpha-1, 4.0.0-alpha-2
-
None
-
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(), "");