mirror of
https://github.com/apache/sqoop.git
synced 2025-05-17 01:11:07 +08:00
SQOOP-1112: Sqoop2: Date splitter might return splits omitting some boundaries
(Venkat Ranganathan via Jarek Jarcec Cecho)
This commit is contained in:
parent
8c74223b59
commit
d4b2d61653
@ -128,10 +128,9 @@ protected List<Partition> partitionDateTimeColumn() {
|
||||
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"));
|
||||
|
||||
|
@ -268,9 +268,10 @@ public void testDatePartition() throws Exception {
|
||||
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 void testDatePartition() throws Exception {
|
||||
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 void testTimePartition() throws Exception {
|
||||
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'",
|
||||
|
Loading…
Reference in New Issue
Block a user