Skip to content

Commit e226538

Browse files
authored
Merge pull request confluentinc#251 from fpietka/fix/fastavro-complex-schema
Use schemaless reader to handle complex schema
2 parents a7963d0 + fb8eff2 commit e226538

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

confluent_kafka/avro/serializer/message_serializer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
HAS_FAST = False
4141
try:
42-
from fastavro.reader import read_data
42+
from fastavro import schemaless_reader
4343

4444
HAS_FAST = True
4545
except ImportError:
@@ -169,15 +169,15 @@ def _get_decoder_func(self, schema_id, payload):
169169
# try to use fast avro
170170
try:
171171
schema_dict = schema.to_json()
172-
read_data(payload, schema_dict)
172+
schemaless_reader(payload, schema_dict)
173173

174174
# If we reach this point, this means we have fastavro and it can
175175
# do this deserialization. Rewind since this method just determines
176176
# the reader function and we need to deserialize again along the
177177
# normal path.
178178
payload.seek(curr_pos)
179179

180-
self.id_to_decoder_func[schema_id] = lambda p: read_data(p, schema_dict)
180+
self.id_to_decoder_func[schema_id] = lambda p: schemaless_reader(p, schema_dict)
181181
return self.id_to_decoder_func[schema_id]
182182
except Exception:
183183
# Fast avro failed, fall thru to standard avro below.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy