cdc-apache-cassandra icon indicating copy to clipboard operation
cdc-apache-cassandra copied to clipboard

[Source][NativeJsonConveter] Use logical types instead of names to select the proper type converter

Open aymkhalil opened this issue 2 years ago • 0 comments

For logical types, the AVRO schema.getLogicalType() always returns null although the name of the logical type is populated. The NativeJsonConverter for now relies on the schema.getName() instead to select the right converter. Some debugging is required to decide why the logical type is not populated. Here is an example:

   {
        "name": "xdecimal",
        "type": [
          "null",
          {
            "type": "record",
            "name": "cql_decimal",
            "namespace": "",
            "fields": [
              {
                "name": "bigint",
                "type": "bytes"
              },
              {
                "name": "scale",
                "type": "int"
              }
            ],
            "logicalType": "cql_decimal"
          }
        ]
      }

schema.getLogicalType() is expected to return cql_decimal but it returns null instead.

aymkhalil avatar Aug 16 '22 17:08 aymkhalil