aboutsummaryrefslogtreecommitdiff
path: root/contrib/storage-jdbc/src
diff options
context:
space:
mode:
authorjiang-wu <jwu@alumni.stanford.edu>2018-05-01 14:48:26 -0700
committerAman Sinha <asinha@maprtech.com>2018-05-11 15:58:36 -0700
commitc1f0adc9276ab8314ce9c5dff2d9c92066c71530 (patch)
tree9d8c13bb25ae76af3b0b2cc6c73fa53ce66dd1ae /contrib/storage-jdbc/src
parent16659ab30fd9fca5af39edd22aaab36409a50930 (diff)
DRILL-6242 Use java.time.Local{Date|Time|DateTime} for Drill Date, Time, Timestamp types. (#3)
close apache/drill#1247 * DRILL-6242 - Use java.time.Local{Date|Time|DateTime} classes to hold values from corresponding Drill date, time, and timestamp types. Conflicts: exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/ExtendedJsonOutput.java Fix merge conflicts and check style.
Diffstat (limited to 'contrib/storage-jdbc/src')
-rw-r--r--contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithDerbyIT.java12
-rw-r--r--contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMySQLIT.java15
2 files changed, 12 insertions, 15 deletions
diff --git a/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithDerbyIT.java b/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithDerbyIT.java
index f74476023..e2e408956 100644
--- a/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithDerbyIT.java
+++ b/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithDerbyIT.java
@@ -19,10 +19,9 @@ package org.apache.drill.exec.store.jdbc;
import org.apache.drill.categories.JdbcStorageTest;
import org.apache.drill.PlanTestBase;
+import org.apache.drill.exec.expr.fn.impl.DateUtility;
import org.apache.drill.exec.proto.UserBitShared;
-import org.joda.time.DateTime;
-
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -58,16 +57,15 @@ public class TestJdbcPluginWithDerbyIT extends PlanTestBase {
"FLOAT_FIELD", "REAL_FIELD", "TIME_FIELD", "TIMESTAMP_FIELD", "DATE_FIELD", "CLOB_FIELD")
.baselineValues(1, "first_name_1", "last_name_1", "1401 John F Kennedy Blvd", "Philadelphia", "PA",
19107, "{ a : 5, b : 6 }", 123456L, 1, 10.01, false, 1.0, 1.1, 111.00,
- new DateTime(1970, 1, 1, 13, 0, 1), new DateTime(2012, 2, 29, 13, 0, 1), new DateTime(2012, 2, 29, 0, 0, 0), "some clob data 1")
+ DateUtility.parseLocalTime("13:00:01.0"), DateUtility.parseLocalDateTime("2012-02-29 13:00:01.0"), DateUtility.parseLocalDate("2012-02-29"), "some clob data 1")
.baselineValues(2, "first_name_2", "last_name_2", "One Ferry Building", "San Francisco", "CA",
94111, "{ foo : \"abc\" }", 95949L, 2, 20.02, true, 2.0, 2.1, 222.00,
- new DateTime(1970, 1, 1, 23, 59, 59), new DateTime(1999, 9, 9, 23, 59, 59), new DateTime(1999, 9, 9, 0, 0, 0), "some more clob data")
+ DateUtility.parseLocalTime("23:59:59.0"), DateUtility.parseLocalDateTime("1999-09-09 23:59:59.0"), DateUtility.parseLocalDate("1999-09-09"), "some more clob data")
.baselineValues(3, "first_name_3", "last_name_3", "176 Bowery", "New York", "NY",
10012, "{ z : [ 1, 2, 3 ] }", 45456L, 3, 30.04, true, 3.0, 3.1, 333.00,
- new DateTime(1970, 1, 1, 11, 34, 21), new DateTime(2011, 10, 30, 11, 34, 21), new DateTime(2011, 10, 30, 0, 0, 0), "clobber")
+ DateUtility.parseLocalTime("11:34:21.0"), DateUtility.parseLocalDateTime("2011-10-30 11:34:21.0"), DateUtility.parseLocalDate("2011-10-30"), "clobber")
.baselineValues(4, null, null, "2 15th St NW", "Washington", "DC", 20007, "{ z : { a : 1, b : 2, c : 3 } " +
- "}", -67L, 4, 40.04, false, 4.0, 4.1, 444.00, new DateTime(1970, 1, 1, 16, 0, 1), new DateTime
- (2015, 6, 1, 16, 0, 1), new DateTime(2015, 6, 1, 0, 0, 0), "xxx")
+ "}", -67L, 4, 40.04, false, 4.0, 4.1, 444.00, DateUtility.parseLocalTime("16:00:01.0"), DateUtility.parseLocalDateTime("2015-06-01 16:00:01.0"), DateUtility.parseLocalDate("2015-06-01"), "xxx")
.baselineValues(5, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null)
.build().run();
diff --git a/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMySQLIT.java b/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMySQLIT.java
index 7b8c21acc..164091309 100644
--- a/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMySQLIT.java
+++ b/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMySQLIT.java
@@ -18,10 +18,9 @@
package org.apache.drill.exec.store.jdbc;
import org.apache.drill.categories.JdbcStorageTest;
+import org.apache.drill.exec.expr.fn.impl.DateUtility;
import org.apache.drill.PlanTestBase;
-import org.joda.time.DateTime;
-
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -40,7 +39,7 @@ public class TestJdbcPluginWithMySQLIT extends PlanTestBase {
"first_name, last_name, address, city, state, zip, " +
"bigint_field, smallint_field, numeric_field, " +
"boolean_field, double_field, float_field, real_field, " +
- "date_field, datetime_field, year_field, " +
+ "date_field, datetime_field, year_field, time_field, " +
"json, text_field, tiny_text_field, medium_text_field, long_text_field, " +
"blob_field, bit_field, enum_field " +
"from mysql.`drill_mysql_test`.person")
@@ -50,7 +49,7 @@ public class TestJdbcPluginWithMySQLIT extends PlanTestBase {
"bigint_field", "smallint_field", "numeric_field",
"boolean_field",
"double_field", "float_field", "real_field",
- "date_field", "datetime_field", "year_field",
+ "date_field", "datetime_field", "year_field", "time_field",
"json", "text_field", "tiny_text_field", "medium_text_field", "long_text_field",
"blob_field", "bit_field", "enum_field")
.baselineValues(1,
@@ -58,7 +57,7 @@ public class TestJdbcPluginWithMySQLIT extends PlanTestBase {
123456789L, 1, 10.01,
false,
1.0, 1.1, 1.2,
- new DateTime(2012, 2, 29, 0, 0, 0), new DateTime(2012, 2, 29, 13, 0, 1), new DateTime(2015, 1, 1, 0, 0, 0),
+ DateUtility.parseLocalDate("2012-02-29"), DateUtility.parseLocalDateTime("2012-02-29 13:00:01.0"), DateUtility.parseLocalDate("2015-01-01"), DateUtility.parseLocalTime("13:00:01.0"),
"{ a : 5, b : 6 }",
"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout",
"xxx",
@@ -71,7 +70,7 @@ public class TestJdbcPluginWithMySQLIT extends PlanTestBase {
45456767L, 3, 30.04,
true,
3.0, 3.1, 3.2,
- new DateTime(2011, 10, 30, 0, 0, 0), new DateTime(2011, 10, 30, 11, 34, 21), new DateTime(2015, 1, 1, 0, 0, 0),
+ DateUtility.parseLocalDate("2011-10-30"), DateUtility.parseLocalDateTime("2011-10-30 11:34:21.0"), DateUtility.parseLocalDate("2015-01-01"), DateUtility.parseLocalTime("11:34:21.0"),
"{ z : [ 1, 2, 3 ] }",
"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout",
"abc",
@@ -84,7 +83,7 @@ public class TestJdbcPluginWithMySQLIT extends PlanTestBase {
123090L, -3, 55.12,
false,
5.0, 5.1, 5.55,
- new DateTime(2015, 6, 1, 0, 0, 0), new DateTime(2015, 9, 22, 15, 46, 10), new DateTime(1901, 1, 1, 0, 0, 0),
+ DateUtility.parseLocalDate("2015-06-01"), DateUtility.parseLocalDateTime("2015-09-22 15:46:10.0"), DateUtility.parseLocalDate("1901-01-01"), DateUtility.parseLocalTime("16:00:01.0"),
"{ [ a, b, c ] }",
"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit",
"abc",
@@ -97,7 +96,7 @@ public class TestJdbcPluginWithMySQLIT extends PlanTestBase {
null, null, null,
null,
null, null, null,
- null, null, null,
+ null, null, null, null,
null,
null,
null,