sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject git commit: SQOOP-1048: Sqoop2: NPE when importing NULL value
Date Mon, 20 May 2013 13:13:09 GMT
Updated Branches:
  refs/heads/sqoop2 2941fa666 -> 61335e6e8


SQOOP-1048: Sqoop2: NPE when importing NULL value

(Vasanth kumar RJ via Jarek Jarcec Cecho)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/61335e6e
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/61335e6e
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/61335e6e

Branch: refs/heads/sqoop2
Commit: 61335e6e821c40dfa258c8000514c5d1040d1788
Parents: 2941fa6
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Mon May 20 06:12:28 2013 -0700
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Mon May 20 06:12:28 2013 -0700

----------------------------------------------------------------------
 .../jdbc/GenericJdbcConnectorConstants.java        |    2 ++
 .../connector/jdbc/GenericJdbcImportExtractor.java |    3 ++-
 2 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/61335e6e/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnectorConstants.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnectorConstants.java
b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnectorConstants.java
index 23f19b5..abcc89d 100644
--- a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnectorConstants.java
+++ b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnectorConstants.java
@@ -51,6 +51,8 @@ public final class GenericJdbcConnectorConstants {
 
   public static final String SUBQUERY_ALIAS = "SQOOP_SUBQUERY_ALIAS";
 
+  public static final String SQL_NULL_VALUE = "null";
+
   private GenericJdbcConnectorConstants() {
     // Disable explicit object creation
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/61335e6e/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportExtractor.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportExtractor.java
b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportExtractor.java
index d54b430..3f9aa9b 100644
--- a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportExtractor.java
+++ b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportExtractor.java
@@ -55,7 +55,8 @@ public class GenericJdbcImportExtractor extends Extractor<ConnectionConfiguratio
       while (resultSet.next()) {
         Object[] array = new Object[column];
         for (int i = 0; i< column; i++) {
-          array[i] = resultSet.getObject(i+1);
+          array[i] = resultSet.getObject(i + 1) == null ? GenericJdbcConnectorConstants.SQL_NULL_VALUE
+              : resultSet.getObject(i + 1);
         }
         context.getDataWriter().writeArrayRecord(array);
         rowsRead++;


Mime
View raw message