sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cheol...@apache.org
Subject [3/3] git commit: SQOOP-888: Move out checking of special condition token to Validator in Generic JDBC Manager
Date Fri, 22 Feb 2013 20:19:23 GMT
Updated Branches:
  refs/heads/sqoop2 07d5a4f00 -> 339069f32


SQOOP-888: Move out checking of special condition token to Validator in Generic JDBC Manager

(Jarcec Cecho via Cheolsoo Park)


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

Branch: refs/heads/sqoop2
Commit: 6eb27b821d873c92e20d71260293f4a842b804dc
Parents: 07d5a4f
Author: Cheolsoo Park <cheolsoo@apache.org>
Authored: Fri Feb 22 11:41:36 2013 -0800
Committer: Cheolsoo Park <cheolsoo@apache.org>
Committed: Fri Feb 22 12:19:06 2013 -0800

----------------------------------------------------------------------
 .../jdbc/GenericJdbcImportInitializer.java         |    7 +------
 .../sqoop/connector/jdbc/GenericJdbcValidator.java |    5 +++++
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/6eb27b82/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportInitializer.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportInitializer.java
b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportInitializer.java
index ad95e65..46c7ee7 100644
--- a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportInitializer.java
+++ b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportInitializer.java
@@ -216,12 +216,7 @@ public class GenericJdbcImportInitializer extends Initializer<ConnectionConfigur
     } else if (tableSql != null) {
       // when table sql is specified:
 
-      if (tableSql.indexOf(
-          GenericJdbcConnectorConstants.SQL_CONDITIONS_TOKEN) == -1) {
-        // make sure substitute token for conditions is in the specified sql
-        throw new SqoopException(
-            GenericJdbcConnectorError.GENERIC_JDBC_CONNECTOR_0010);
-      }
+      assert tableSql.contains(GenericJdbcConnectorConstants.SQL_CONDITIONS_TOKEN);
 
       if (tableColumns == null) {
         dataSql = tableSql;

http://git-wip-us.apache.org/repos/asf/sqoop/blob/6eb27b82/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcValidator.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcValidator.java
b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcValidator.java
index 152eee1..e098fbc 100644
--- a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcValidator.java
+++ b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcValidator.java
@@ -103,6 +103,11 @@ public class GenericJdbcValidator extends Validator {
       validation.addMessage(Status.UNACCEPTABLE, "table", "Both table name and SQL cannot
be specified");
     }
 
+    if(configuration.table.sql != null && !configuration.table.sql.contains(GenericJdbcConnectorConstants.SQL_CONDITIONS_TOKEN))
{
+      validation.addMessage(Status.UNACCEPTABLE, "table", "sql", "SQL statement must contain
placeholder for auto generated "
+        + "conditions - " + GenericJdbcConnectorConstants.SQL_CONDITIONS_TOKEN);
+    }
+
     return validation;
   }
 }


Mime
View raw message