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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.debezium.spi.converter.CustomConverter
io.debezium.spi.converter.CustomConverter.Converter, io.debezium.spi.converter.CustomConverter.ConverterRegistration<S extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprivate JdbcValueConverters.DecimalModeprivate static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(Properties props) voidconverterFor(io.debezium.spi.converter.RelationalColumn field, io.debezium.spi.converter.CustomConverter.ConverterRegistration<org.apache.kafka.connect.data.SchemaBuilder> registration)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
DECIMAL_MODE_PROPERTY
- See Also:
-
decimalMode
-
-
Constructor Details
-
NumberToZeroScaleConverter
public NumberToZeroScaleConverter()
-
-
Method Details
-
configure
- Specified by:
configurein interfaceio.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:
converterForin interfaceio.debezium.spi.converter.CustomConverter<org.apache.kafka.connect.data.SchemaBuilder,io.debezium.spi.converter.RelationalColumn>
-