-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does KSQL supports binary Avro format? #1820
Comments
Yes, Avro is a supported data format. Note that Avro support in KSQL requires Confluent Schema Registry, which means the Kafka messages must follow the associated schema registry compatible wire protocol for Avro. |
Also be advised that the bytes type is currently not supported. |
BYTES type: see #1742 |
thanks for answers, but it still not clear to me whether binary Avro records are supported. val datumWriter = new SpecificDatumWriter[T](entity.getSchema)
val objectWriter = new DataFileWriter(datumWriter)
val bytes = new ByteArrayOutputStream()
objectWriter.setCodec(CodecFactory.nullCodec())
objectWriter.create(entity.getSchema, bytes)
objectWriter.append(entity)
objectWriter.close()
bytes.toByteArray I have registered corresponding schema for value in Schema Registry. When I try to read from stream - I get deserealization exception. |
@yana2301: Sorry if my original reply wasn't clear.
Yes, binary Avro is supported (as far as I understand you), but the Kafka message must included two additional pieces of information in addition to the serialized Avro bytes in order to be compatible with Schema Registry's wire format. If you just serialize the bytes, you have covered only row #3 in the screenshot below (bytes 5 onwards in the wire format), but you must also provide (1) the magic byte and (2) the Avro schema id. |
Oh, and a note: KSQL supports only Kafka message keys of type See #824 |
@miguno thanks for response, this is really helpful! |
@miguno So what about Apache Kafka? Meaning what if I'm not using Confluent Kafka? |
Hello,
I have a question on support of Avro format.
There is topic in Kafka that contains binary avro records, byte arrays.
I can define stream or table in Avro format for this topic, but when try to read from it - I get deserealization exception.
Could anyone tell me please, is this use-case supported now?
The text was updated successfully, but these errors were encountered: