tanclary commented on code in PR #4060:
URL: https://github.com/apache/calcite/pull/4060#discussion_r1854518515
##########
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:
So the mechanism going from millis->timestamp String actually lives in
DateTimeUtils in Avatica and is pretty well-tested in DateTimeUtilsTest (let me
know if you need links.) The real bug here is that JSON doesn't distinguish the
numeric types so we have to ensure it's a Long (or convert) it. So that's the
scope I'm trying to test here.
--
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]