darkamgine commented on a change in pull request #631:
URL: https://github.com/apache/orc/pull/631#discussion_r559550515
##########
File path: java/tools/src/test/org/apache/orc/tools/convert/TestJsonReader.java
##########
@@ -72,4 +75,25 @@ public void testTimestampOffByOne() throws Exception {
assertEquals("1969-12-31 23:59:58.9999",
cv.asScratchTimestamp(5).toString());
}
+ @Test
+ public void testDateTypeSupport() throws IOException {
+ LocalDate date1 = LocalDate.of(2021, 1, 18);
+ LocalDate date2 = LocalDate.now();
+ String inputString = "{\"dt\": \"" + date1.toString() + "\"}\n" +
+ "{\"dt\": \"" + date2.toString() + "\"}\n";
+
+
+ StringReader input = new StringReader(inputString);
+
+ TypeDescription schema = TypeDescription.fromString("struct<dt:date>");
+ JsonReader reader = new JsonReader(input, null, 1, schema, "");
+ VectorizedRowBatch batch = schema.createRowBatch(2);
+ assertEquals(true, reader.nextBatch(batch));
+ assertEquals(2, batch.size);
+ DateColumnVector cv = (DateColumnVector) batch.cols[0];
+ assertEquals(date1, LocalDate.ofEpochDay(cv.vector[0]));
+ assertEquals(date2, LocalDate.ofEpochDay(cv.vector[1]));
+
+ }
+
Review comment:
added timestamp conversion tests
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]