ijokarumawak commented on a change in pull request #971: [CALCITE-1703]
Functions on TIMESTAMP column throws ClassCastException
URL: https://github.com/apache/calcite/pull/971#discussion_r273301178
##########
File path: core/src/test/java/org/apache/calcite/test/ObjectArrayTableTest.java
##########
@@ -241,6 +244,35 @@ private void withJavaSqlDateTypes(TestWithConnection
test) throws SQLException {
});
}
+
+ /**
+ * Test to confirm java.sql.Timestamp can be casted to Timestamp with
different precision.
+ * The cast should be done the same as with TIMESTAMP literal.
+ */
+ @Test public void testCastTimestampToTimestamp() throws SQLException {
+
+ withJavaSqlDateTypes(connection -> {
+
+ Statement statement = connection.createStatement();
+ final String sql = "select %s as EXPECTED, %s as ACTUAL from
\"java_sql_date_types\"";
+
+ for (int i = 3; i >= 0; i--) {
+ final String castTo = format(Locale.ROOT, "TIMESTAMP(%d)", i);
Review comment:
Changed to simple string concatenation using `+`.
----------------------------------------------------------------
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]
With regards,
Apache Git Services