You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2016/09/27 14:19:19 UTC
nifi git commit: NIFI-2811 JdbcCommon doesn't convert bigint(20)
column.
Repository: nifi
Updated Branches:
refs/heads/master 30f008d67 -> 28acb0743
NIFI-2811 JdbcCommon doesn't convert bigint(20) column.
Signed-off-by: Matt Burgess <ma...@apache.org>
This closes #1053
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/28acb074
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/28acb074
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/28acb074
Branch: refs/heads/master
Commit: 28acb07433106db0ab17da9719cd877ae8a6d2ce
Parents: 30f008d
Author: Byunghwa Yun <co...@combineads.co.kr>
Authored: Fri Sep 23 15:34:49 2016 +0900
Committer: Matt Burgess <ma...@apache.org>
Committed: Tue Sep 27 10:18:48 2016 -0400
----------------------------------------------------------------------
.../nifi/processors/standard/util/JdbcCommon.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/28acb074/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java
index b591d01..0aa4c60 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java
@@ -177,8 +177,8 @@ public class JdbcCommon {
// long (and the schema says it will be), so try to get its value as a long.
// Otherwise, Avro can't handle BigInteger as a number - it will throw an AvroRuntimeException
// such as: "Unknown datum type: java.math.BigInteger: 38". In this case the schema is expecting a string.
- int precision = meta.getPrecision(i);
if (javaSqlType == BIGINT) {
+ int precision = meta.getPrecision(i);
if (precision < 0 || precision > MAX_DIGITS_IN_BIGINT) {
rec.put(i - 1, value.toString());
} else {
@@ -194,7 +194,16 @@ public class JdbcCommon {
}
} else if (value instanceof Number || value instanceof Boolean) {
- rec.put(i - 1, value);
+ if (javaSqlType == BIGINT) {
+ int precision = meta.getPrecision(i);
+ if (precision < 0 || precision > MAX_DIGITS_IN_BIGINT) {
+ rec.put(i - 1, value.toString());
+ } else {
+ rec.put(i - 1, value);
+ }
+ } else {
+ rec.put(i - 1, value);
+ }
} else {
// The different types that we support are numbers (int, long, double, float),