Jyothsna Konisa created CASSANALYTICS-203:
---------------------------------------------
Summary: CDC Avro serialization fails for UDT columns: UDT values
are not converted to Avro records
Key: CASSANALYTICS-203
URL: https://issues.apache.org/jira/browse/CASSANALYTICS-203
Project: Apache Cassandra Analytics
Issue Type: Bug
Components: CDC
Reporter: Jyothsna Konisa
CDC events with UDT columns (frozen<udt>, udt, or UDTs inside collections such
as list<frozen<udt>>) fail to publish. The UDT value reaches the Avro encoder
as raw bytes instead of a record:
java.lang.ClassCastException: value java.nio.HeapByteBuffer[...] cannot be cast
to expected type record_udt at CassandraCDC.payload.results[array][0]
Root cause: the CDC codec decodes column values with
CqlType#deserializeToJavaType, which uses Cassandra's serializers. Cassandra's
UserTypeSerializer returns UDTs as raw bytes, and AvroDataUtils#toAvro only
converts a Map into a UDT record. The Spark path avoids this by decoding
through deserializeToType(TypeConverter) with CqlUdt#deserializeUdt; the CDC
path never did.
Fix: add a TypeConverter in AvroDataUtils that decodes UDT bytes with the
existing CqlUdt#deserializeUdt, including UDTs inside collections, tuples and
other UDTs. Use it from the four codec call sites via
AvroDataUtils#deserialize. Types without UDTs are unchanged.
Related: CASSSIDECAR-507 (CDC fails to deserialize nested UDT columns) fixes a
Sidecar-side classloader issue. Both fixes are needed for the reported scenario.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]