mihaibudiu commented on code in PR #4060:
URL: https://github.com/apache/calcite/pull/4060#discussion_r1854507924
##########
core/src/test/java/org/apache/calcite/plan/RelWriterTest.java:
##########
@@ -740,6 +740,53 @@ private static Fixture relFn(Function<RelBuilder, RelNode>
relFn) {
.assertThatPlan(isLinux(expected));
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-6703">[CALCITE-6703]
+ * RelJson cannot handle timestamps prior to 1970-01-25 20:31:23.648</a>. */
+ @Test void testJsonToRexForTimestamp() {
+ final String timestampRepresentedAsInt = "{\n"
+ + " \"literal\": 2129400000,\n"
+ + " \"type\": {\n"
+ + " \"type\": \"TIMESTAMP\",\n"
+ + " \"nullable\": false\n"
+ + " }\n"
+ + "}\n";
+ final String timestampRepresentedAsLong = "{\n"
+ + " \"literal\": 3129400000,\n"
+ + " \"type\": {\n"
+ + " \"type\": \"TIMESTAMP\",\n"
+ + " \"nullable\": false\n"
+ + " }\n"
+ + "}\n";
+
+ assertThatReadExpressionResult(timestampRepresentedAsInt, is("1970-01-25
15:30:00"));
Review Comment:
is this supposed to work for dates before the epoch or the Gregorian
calendar cutoff?
maybe you can add tests for these too - if they are not supposed to work,
the errors can be tested.
##########
core/src/test/java/org/apache/calcite/plan/RelWriterTest.java:
##########
@@ -740,6 +740,53 @@ private static Fixture relFn(Function<RelBuilder, RelNode>
relFn) {
.assertThatPlan(isLinux(expected));
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-6703">[CALCITE-6703]
+ * RelJson cannot handle timestamps prior to 1970-01-25 20:31:23.648</a>. */
+ @Test void testJsonToRexForTimestamp() {
+ final String timestampRepresentedAsInt = "{\n"
+ + " \"literal\": 2129400000,\n"
+ + " \"type\": {\n"
+ + " \"type\": \"TIMESTAMP\",\n"
+ + " \"nullable\": false\n"
+ + " }\n"
+ + "}\n";
+ final String timestampRepresentedAsLong = "{\n"
+ + " \"literal\": 3129400000,\n"
Review Comment:
not easy to check that this value corresponds to the date below.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]