matthewgettemy opened a new issue #9483:
URL: https://github.com/apache/pulsar/issues/9483
Are nested types supported in pulsar.schema.Record?
An example payload that I'd like to de/serialize is
`values={"A": [1.1, 2.2, 3.3], "B": [5.5, 6.6, 7.7]}`
### Minimal example:
```
from pulsar.schema import AvroSchema
from pulsar.schema import Record
from pulsar.schema import Map
from pulsar.schema import Array
from pulsar.schema import Float
class Apex(Record):
values = Map(Array(Float()))
client = pulsar.Client("pulsar://localhost:6650")
producer = client.create_producer("example", schema=AvroSchema(Apex))
```
### Produces:
2021-02-04 08:53:45.513 INFO [140206084425536] ConnectionPool:85 | Created
connection for pulsar://localhost:6650
2021-02-04 08:53:45.515 INFO [140205875353344] ClientConnection:353 |
[127.0.0.1:54658 -> 127.0.0.1:6650] Connected to broker
2021-02-04 08:53:45.522 INFO [140205875353344] HandlerBase:54 |
[persistent://public/default/example, ] Getting connection from pool
2021-02-04 08:53:45.539 WARN [140205875353344] ClientConnection:960 |
[127.0.0.1:54658 -> 127.0.0.1:6650] Received error response from server:
IncompatibleSchema -- req_id: 0
2021-02-04 08:53:45.539 ERROR [140205875353344] ProducerImpl:234 |
[persistent://public/default/example, ] Failed to create producer:
IncompatibleSchema
2021-02-04 08:53:45.539 INFO [140205875353344] ProducerImpl:527 | Producer
- [persistent://public/default/example, ] , [batching = off]
Traceback (most recent call last):
File "producer.py", line 15, in <module>
producer = client.create_producer("example", schema=AvroSchema(Apex))
File "/opt/anaconda3/lib/python3.6/site-packages/pulsar/__init__.py", line
562, in create_producer
p._producer = self._client.create_producer(topic, conf)
**Exception: Pulsar error: IncompatibleSchema**
I'm wondering if I'm specifying the type structure wrong, or is this just
not supported?
With the Kafka schema registry, I can setup an avro .json config and specify
nested types like Map(Array), but can't figure out how to do it with this
interface. If this is not supported I'd be interested in contributing an
enhancement for it, if it's agreed it should be supported.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]