You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Bing Angus <an...@gmail.com> on 2020/05/22 03:00:28 UTC

Hello

Testing

Re: Problem reading Avro file

Posted by Bing Angus <an...@gmail.com>.
Please ignore this. Found out that the schema that was included in the
Kafka message was different than the schema of the Avro file.

On Fri, May 22, 2020 at 8:15 AM Bing Angus <an...@gmail.com> wrote:

>
> Hello
>
> Using Java, I create an Avro file. I send it to Kafka binary-encoded.
> Again with Java, I am able to consume the message in Kafka and successfully
> read the Avro file.
>
>
> Using Python for consumer, I am able to consume the same message but I get
> an error reading the Avro file.
>
> Environment:
> Python 3.7.4
> Avro-Python3 1.9.2.1
> Kafka-Python 2.0.1
>
> Code:
>
> consumer = KafkaConsumer(topic, conf)
> for record in consumer:
>   bytes = io.BytesIO(record.value)
>   decoder = BinaryDecoder(bytes)
>   schema = avro.schema.parse(record.headers[0][1])
>   print(schema) #ok
>   reader = DatumReader(schema)
>   genrec = reader.read(decoder) #fail
>
> Error:
> AssertionError: <some number>
> Occurs in io.py BinaryDecoder class, read_bytes()
>
>
>
> Best regards,
> Dale
>
>

Problem reading Avro file

Posted by Bing Angus <an...@gmail.com>.
Hello

Using Java, I create an Avro file. I send it to Kafka binary-encoded. Again
with Java, I am able to consume the message in Kafka and successfully read
the Avro file.


Using Python for consumer, I am able to consume the same message but I get
an error reading the Avro file.

Environment:
Python 3.7.4
Avro-Python3 1.9.2.1
Kafka-Python 2.0.1

Code:

consumer = KafkaConsumer(topic, conf)
for record in consumer:
  bytes = io.BytesIO(record.value)
  decoder = BinaryDecoder(bytes)
  schema = avro.schema.parse(record.headers[0][1])
  print(schema) #ok
  reader = DatumReader(schema)
  genrec = reader.read(decoder) #fail

Error:
AssertionError: <some number>
Occurs in io.py BinaryDecoder class, read_bytes()



Best regards,
Dale

Re: Hello

Posted by Zahid Rahman <za...@gmail.com>.
Your test is successful. If you see this message.


On Fri, 22 May 2020, 04:00 Bing Angus, <an...@gmail.com> wrote:

> Testing
>