Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<commons.csv.version>1.6</commons.csv.version>
<jackson.version>1.9.13</jackson.version>
<jackson2.version>2.17.1</jackson2.version>
<json.version>20180813</json.version>
<json.version>20231013</json.version>
<awaitility.version>3.1.6</awaitility.version>
<commons-logging.version>1.2</commons-logging.version>
<testSourceLocation>${project.basedir}/src/test/java/</testSourceLocation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.slf4j.LoggerFactory;
import scala.reflect.ClassTag$;

import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
Expand Down Expand Up @@ -148,6 +149,13 @@ private static Object convertValue(Object value, Schema.Field field) {
}
}

// NOTE: org.json >= 20230227 returns BigDecimal for all non-integer JSON numbers.
if (value instanceof BigDecimal && fieldSchemaType.equals(Schema.Type.DOUBLE)) {
// Avro Schema.Type.DOUBLE expects a Double instance (or primitive double) at serialization time,
// so converting BigDecimal → double for compatibility.
return ((BigDecimal) value).doubleValue();
}

return value;
}

Expand Down
Loading