sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject git commit: SQOOP-1112: Sqoop2: Date splitter might return splits omitting some boundaries
Date Tue, 02 Jul 2013 23:30:24 GMT
Updated Branches:
  refs/heads/sqoop2 8c74223b5 -> d4b2d6165


SQOOP-1112: Sqoop2: Date splitter might return splits omitting some boundaries

(Venkat Ranganathan 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/d4b2d616
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/d4b2d616
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/d4b2d616

Branch: refs/heads/sqoop2
Commit: d4b2d61653dee63a8624895ae1198eb7fa3b551c
Parents: 8c74223
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Tue Jul 2 16:29:27 2013 -0700
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Tue Jul 2 16:29:27 2013 -0700

----------------------------------------------------------------------
 .../connector/jdbc/GenericJdbcImportPartitioner.java  |  5 ++---
 .../sqoop/connector/jdbc/TestImportPartitioner.java   | 14 +++++++++-----
 2 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/d4b2d616/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportPartitioner.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportPartitioner.java
b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportPartitioner.java
index 0bb979e..74dd1b8 100644
--- a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportPartitioner.java
+++ b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportPartitioner.java
@@ -128,10 +128,9 @@ public class GenericJdbcImportPartitioner extends Partitioner<ConnectionConfigur
         break;
     }
 
-    long tzOffset = TimeZone.getDefault().getRawOffset();
 
-    minDateValue += tzOffset;
-    maxDateValue += tzOffset;
+    minDateValue += TimeZone.getDefault().getOffset(minDateValue);
+    maxDateValue += TimeZone.getDefault().getOffset(maxDateValue);
 
     sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d4b2d616/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestImportPartitioner.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestImportPartitioner.java
b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestImportPartitioner.java
index 1a3601a..d46e4dd 100644
--- a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestImportPartitioner.java
+++ b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestImportPartitioner.java
@@ -268,9 +268,10 @@ public class TestImportPartitioner extends TestCase {
     context.setString(GenericJdbcConnectorConstants
         .CONNECTOR_JDBC_PARTITION_COLUMNTYPE, String.valueOf(Types.DATE));
     context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_MINVALUE,
-        Date.valueOf("2013-01-01").toString());
+        Date.valueOf("2004-10-20").toString());
     context.setString(GenericJdbcConnectorConstants
-        .CONNECTOR_JDBC_PARTITION_MAXVALUE, Date.valueOf("2013-12-31").toString());
+        .CONNECTOR_JDBC_PARTITION_MAXVALUE, Date.valueOf("2013-10-17")
+        .toString());
 
 
     ConnectionConfiguration connConf = new ConnectionConfiguration();
@@ -280,10 +281,12 @@ public class TestImportPartitioner extends TestCase {
     PartitionerContext partitionerContext = new PartitionerContext(context,
         3);
     List<Partition> partitions = partitioner.getPartitions(partitionerContext, connConf,
jobConf);
+
+
     verifyResult(partitions, new String[]{
-        "'2013-01-01' <= DCOL AND DCOL < '2013-05-02'",
-        "'2013-05-02' <= DCOL AND DCOL < '2013-08-31'",
-        "'2013-08-31' <= DCOL AND DCOL <= '2013-12-31'",
+        "'2004-10-20' <= DCOL AND DCOL < '2007-10-19'",
+        "'2007-10-19' <= DCOL AND DCOL < '2010-10-18'",
+        "'2010-10-18' <= DCOL AND DCOL <= '2013-10-17'",
     });
 
   }
@@ -307,6 +310,7 @@ public class TestImportPartitioner extends TestCase {
     PartitionerContext partitionerContext = new PartitionerContext(context,
         3);
     List<Partition> partitions = partitioner.getPartitions(partitionerContext, connConf,
jobConf);
+
     verifyResult(partitions, new String[]{
         "'01:01:01' <= TCOL AND TCOL < '04:14:17'",
         "'04:14:17' <= TCOL AND TCOL < '07:27:33'",


Mime
View raw message