There are three different ways a pulsar sink can receive a logical type depending on how the message was generated. Below, I'll use C* Decimal type (BigDecimal in Java) as an example:
Using Pulsar API Schema.AVRO(org.apache.pulsar.client.api.MyPojo.class) where MyPojo has a BigDecimal field. The generate output schema is:
Caused by: java.lang.UnsupportedOperationException: No recommended schema for decimal (scale is required)
Using Native AVRO APIs (LogicalTypes.decimal(precision, scale).addToSchema(org.apache.avro.Schema.create(org.apache.avro.Schema.Type.BYTES))))) to add logical schema to bytes. This is matching the AVRO standard mentioned here. Example schema:
There are three different ways a pulsar sink can receive a logical type depending on how the message was generated. Below, I'll use C* Decimal type (BigDecimal in Java) as an example:
Schema.AVRO(org.apache.pulsar.client.api.MyPojo.class)
where MyPojo has aBigDecimal
field. The generate output schema is:The pulsar sink will fail with
LogicalTypes.decimal(precision, scale).addToSchema(org.apache.avro.Schema.create(org.apache.avro.Schema.Type.BYTES))))
) to add logical schema to bytes. This is matching the AVRO standard mentioned here. Example schema:42 Using a logical CQL type that comes from a C* CDC source, the schema will be:
and this will cause the sink to fail with: