-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
False
-
None
-
False
-
-
Oracle connector allows to use negative scale for NUMBER type: A negative scale indicates rounding in Oracle, for example, a scale of -2 causes rounding to hundreds.
Typically, the scale factor is stored in the registry. However, Avro specification doesn't allow negative scales: Scale must be zero or a positive integer less than or equal to the precision.
When Debezium is used with Apicurio schema registry, which require the scale to be positive, storing NUMBER with negative scale fails with
Problem with message on topic 'server1.DEBEZIUM.TYPE_INT': java.lang.IllegalArgumentException: Invalid decimal scale: -2 (must be positive) at org.apache.avro.LogicalTypes$Decimal.validate(LogicalTypes.java:255) at org.apache.avro.LogicalType.addToSchema(LogicalType.java:68) at org.apache.avro.LogicalTypes$Decimal.addToSchema(LogicalTypes.java:227) at io.apicurio.registry.utils.converter.avro.AvroData.fromConnectSchema(AvroData.java:947) at io.apicurio.registry.utils.converter.avro.AvroData.addAvroRecordField(AvroData.java:1062) at io.apicurio.registry.utils.converter.avro.AvroData.fromConnectSchema(AvroData.java:903) at io.apicurio.registry.utils.converter.avro.AvroData.fromConnectSchemaWithCycle(AvroData.java:1025) at io.apicurio.registry.utils.converter.avro.AvroData.fromConnectSchema(AvroData.java:890) at io.apicurio.registry.utils.converter.avro.AvroData.addAvroRecordField(AvroData.java:1062) at io.apicurio.registry.utils.converter.avro.AvroData.fromConnectSchema(AvroData.java:903) at io.apicurio.registry.utils.converter.avro.AvroData.fromConnectSchema(AvroData.java:735) at io.apicurio.registry.utils.converter.avro.AvroData.fromConnectSchema(AvroData.java:729) at io.apicurio.registry.utils.converter.avro.AvroData.fromConnectData(AvroData.java:368) at io.apicurio.registry.utils.converter.AvroConverter.applySchema(AvroConverter.java:81) at io.apicurio.registry.utils.converter.SerdeBasedConverter.fromConnectData(SerdeBasedConverter.java:116)
This can be reproduced by running Oracle connector SnapshotDatatypesIT#intTypes test against Apicurio schema registry.