mirror of
https://github.com/apache/sqoop.git
synced 2025-05-02 17:59:21 +08:00
SQOOP-22. Sqoop date tests are too permissive.
Ensure that tests involving dates/times use proper ANSI SQL Date/Time escape formatting (yyyy-mm-dd or hh:mm:ss). After Java 1.6u17, dates of the form yyyy-m-dd or hhⓂ️ss are not parsed by java.sql.Date/Time and throw IllegalArgumentException. From: Aaron Kimball <aaron@cloudera.com> git-svn-id: https://svn.apache.org/repos/asf/incubator/sqoop/trunk@1149934 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6ea1665716
commit
7e473cafa0
@ -633,7 +633,7 @@ protected ColumnGenerator getDateColumnGenerator() {
|
||||
return new ColumnGenerator() {
|
||||
public String getExportText(int rowNum) {
|
||||
int day = rowNum + 1;
|
||||
return "2009-10-" + day;
|
||||
return "2009-10-" + pad(day);
|
||||
}
|
||||
public String getVerifyText(int rowNum) {
|
||||
int day = rowNum + 1;
|
||||
@ -651,7 +651,7 @@ public String getType() {
|
||||
protected ColumnGenerator getTimeColumnGenerator() {
|
||||
return new ColumnGenerator() {
|
||||
public String getExportText(int rowNum) {
|
||||
return "10:01:" + rowNum;
|
||||
return "10:01:" + pad(rowNum);
|
||||
}
|
||||
public String getVerifyText(int rowNum) {
|
||||
return "10:01:" + pad(rowNum);
|
||||
|
@ -721,20 +721,13 @@ public void testDouble2() {
|
||||
|
||||
@Test
|
||||
public void testDate1() {
|
||||
verifyType("DATE", getDateInsertStr("'2009-1-12'"),
|
||||
getDateDbOutput("2009-01-12"),
|
||||
getDateSeqOutput("2009-01-12"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDate2() {
|
||||
verifyType("DATE", getDateInsertStr("'2009-01-12'"),
|
||||
getDateDbOutput("2009-01-12"),
|
||||
getDateSeqOutput("2009-01-12"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDate3() {
|
||||
public void testDate2() {
|
||||
verifyType("DATE", getDateInsertStr("'2009-04-24'"),
|
||||
getDateDbOutput("2009-04-24"),
|
||||
getDateSeqOutput("2009-04-24"));
|
||||
|
Loading…
Reference in New Issue
Block a user