Review Board 1.7.22


Fix for SQOOP-1112

Review Request #12239 - Created July 2, 2013 and updated

Venkat Ranganathan
Reviewers
Sqoop
sqoop-sqoop2
When we worked on SQOOP-1080, we did not take into consideration the daylight savings offsets.  This patch fixes it.
Modified tests to use the paramters that exposed this bug and verified that date partitioning works as expected
connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportPartitioner.java
Revision 0bb979e New Change
[20] 125 lines
[+20] [+] public class GenericJdbcImportPartitioner extends Partitioner<ConnectionConfiguration, ImportJobConfiguration> {
126
        minDateValue = Timestamp.valueOf(partitionMinValue).getTime();
126
        minDateValue = Timestamp.valueOf(partitionMinValue).getTime();
127
        maxDateValue = Timestamp.valueOf(partitionMaxValue).getTime();
127
        maxDateValue = Timestamp.valueOf(partitionMaxValue).getTime();
128
        break;
128
        break;
129
    }
129
    }
130

    
   
130

   
131
    long tzOffset = TimeZone.getDefault().getRawOffset();

   
132

    
   
131

   
133
    minDateValue += tzOffset;
132
    minDateValue += TimeZone.getDefault().getOffset(minDateValue);
134
    maxDateValue += tzOffset;
133
    maxDateValue += TimeZone.getDefault().getOffset(maxDateValue);
135

    
   
134

   
136
    sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
135
    sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
137

    
   
136

   
138
    long interval =  (maxDateValue - minDateValue) / numberPartitions;
137
    long interval =  (maxDateValue - minDateValue) / numberPartitions;
139
    long remainder = (maxDateValue - minDateValue) % numberPartitions;
138
    long remainder = (maxDateValue - minDateValue) % numberPartitions;
[+20] [20] 431 lines
connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestImportPartitioner.java
Revision 1a3601a New Change
 
  1. connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportPartitioner.java: Loading...
  2. connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestImportPartitioner.java: Loading...