Skip to content

Commit 2b9d0a2

Browse files
patch fix
1 parent 2d63ccd commit 2b9d0a2

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

pom.xml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile>
5858
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5959
<!-- version properties -->
60-
<avro.version>1.11.4</avro.version>
60+
<avro.version>1.7.7</avro.version>
6161
<cdap.version>6.8.0</cdap.version>
6262
<junit.version>4.12</junit.version>
6363
<commons.io.version>2.6</commons.io.version>
@@ -420,26 +420,13 @@
420420
<version>${cdap.version}</version>
421421
<scope>test</scope>
422422
</dependency>
423-
<dependency>
424-
<groupId>org.apache.avro</groupId>
425-
<artifactId>avro-mapred</artifactId>
426-
<version>${avro.version}</version>
427-
</dependency>
428423

429424
<dependency>
430425
<groupId>org.apache.spark</groupId>
431426
<artifactId>spark-core_2.11</artifactId>
432427
<version>${spark2.version}</version>
433428
<scope>provided</scope>
434429
<exclusions>
435-
<exclusion>
436-
<groupId>org.apache.avro</groupId>
437-
<artifactId>avro-ipc</artifactId>
438-
</exclusion>
439-
<exclusion>
440-
<groupId>org.apache.avro</groupId>
441-
<artifactId>avro-mapred</artifactId>
442-
</exclusion>
443430
<exclusion>
444431
<groupId>org.slf4j</groupId>
445432
<artifactId>slf4j-log4j12</artifactId>

src/main/java/io/cdap/plugin/salesforce/plugin/source/streaming/SalesforceStreamingSourceUtil.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.slf4j.LoggerFactory;
3434
import scala.reflect.ClassTag$;
3535

36+
import java.math.BigDecimal;
3637
import java.time.Instant;
3738
import java.time.LocalTime;
3839
import java.time.format.DateTimeFormatter;
@@ -148,6 +149,13 @@ private static Object convertValue(Object value, Schema.Field field) {
148149
}
149150
}
150151

152+
// NOTE: org.json >= 20230227 returns BigDecimal for all non-integer JSON numbers.
153+
if (value instanceof BigDecimal && fieldSchem aType.equals(Schema.Type.DOUBLE)) {
154+
// Avro Schema.Type.DOUBLE expects a Double instance (or primitive double) at serialization time,
155+
// so converting BigDecimal → double for compatibility.
156+
return ((BigDecimal) value).doubleValue();
157+
}
158+
151159
return value;
152160
}
153161

0 commit comments

Comments
 (0)