Class NumberToZeroScaleConverter

java.lang.Object
io.debezium.connector.oracle.converters.NumberToZeroScaleConverter
All Implemented Interfaces:
io.debezium.spi.converter.CustomConverter<org.apache.kafka.connect.data.SchemaBuilder,io.debezium.spi.converter.RelationalColumn>

public class NumberToZeroScaleConverter extends Object implements io.debezium.spi.converter.CustomConverter<org.apache.kafka.connect.data.SchemaBuilder,io.debezium.spi.converter.RelationalColumn>
Oracle allows for the NUMBER data type to have negative scale. This can cause issue when converting into Avro format, as Avro specification forbids negative scales. This converter converts sufficiently high number, those which are converted into BigDecimal type, into BigDecimal with a zero scale. The drawback of using this converter is losing the information about the number scale, but shouldn't be a big issue in typical case, as negative scale causes rounding of the number when stored in the database, i.e. the value of the number is correct, we just lose the information that the number could be rounded. For completeness the converter supports also other RelationalDatabaseConnectorConfig.DecimalHandlingMode modes.
Author:
vjuranek
See Also:
  • Field Details

  • Constructor Details

    • NumberToZeroScaleConverter

      public NumberToZeroScaleConverter()
  • Method Details

    • configure

      public void configure(Properties props)
      Specified by:
      configure in interface io.debezium.spi.converter.CustomConverter<org.apache.kafka.connect.data.SchemaBuilder,io.debezium.spi.converter.RelationalColumn>
    • converterFor

      public void converterFor(io.debezium.spi.converter.RelationalColumn field, io.debezium.spi.converter.CustomConverter.ConverterRegistration<org.apache.kafka.connect.data.SchemaBuilder> registration)
      Specified by:
      converterFor in interface io.debezium.spi.converter.CustomConverter<org.apache.kafka.connect.data.SchemaBuilder,io.debezium.spi.converter.RelationalColumn>