datastax / cdc-apache-cassandra

Datastax CDC for Apache Cassandra
Apache License 2.0
35 stars 21 forks source link

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

Open aymkhalil opened 2 years ago

aymkhalil commented 2 years ago

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.