Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
Description
e.g. the following test in RelToSqlConverter.java demonstrates the end-to-end problem:
@Test void testTimestampDiff() { final String query = "select timestampdiff(day, a.\"hire_date\", b.\"hire_date\") " + "from \"employee\" a join \"employee\" b using (\"employee_id\")"; final String expected = "TBD, can't get it to generate right now"; sql(query).ok(expected); }
throws, top of stack:
class org.apache.calcite.sql.SqlSyntax$7: SPECIAL java.lang.UnsupportedOperationException: class org.apache.calcite.sql.SqlSyntax$7: SPECIAL at org.apache.calcite.util.Util.needToImplement(Util.java:1101) at org.apache.calcite.sql.SqlSyntax$7.unparse(SqlSyntax.java:129) at org.apache.calcite.sql.SqlOperator.unparse(SqlOperator.java:383) at org.apache.calcite.sql.SqlDialect.unparseCall(SqlDialect.java:455) at org.apache.calcite.sql.SqlCall.unparse(SqlCall.java:123) at org.apache.calcite.sql.SqlUtil.unparseBinarySyntax(SqlUtil.java:425) at org.apache.calcite.sql.SqlSyntax$4.unparse(SqlSyntax.java:78) at org.apache.calcite.sql.SqlOperator.unparse(SqlOperator.java:383) at org.apache.calcite.sql.SqlDialect.unparseCall(SqlDialect.java:455) at org.apache.calcite.sql.SqlCall.unparse(SqlCall.java:126) at org.apache.calcite.sql.fun.SqlCastFunction.unparse(SqlCastFunction.java:181) at org.apache.calcite.sql.SqlDialect.unparseCall(SqlDialect.java:455) at org.apache.calcite.sql.SqlCall.unparse(SqlCall.java:126) at org.apache.calcite.sql.pretty.SqlPrettyWriter$FrameImpl.list2(SqlPrettyWriter.java:1304) at org.apache.calcite.sql.pretty.SqlPrettyWriter$FrameImpl.list(SqlPrettyWriter.java:1284) at org.apache.calcite.sql.pretty.SqlPrettyWriter.list(SqlPrettyWriter.java:1081) at org.apache.calcite.sql.SqlSelectOperator.unparse(SqlSelectOperator.java:154) at org.apache.calcite.sql.SqlDialect.unparseCall(SqlDialect.java:455) at org.apache.calcite.sql.SqlSelect.unparse(SqlSelect.java:261) at org.apache.calcite.sql.SqlNode.toSqlString(SqlNode.java:156) at org.apache.calcite.rel.rel2sql.RelToSqlConverterTest.toSql(RelToSqlConverterTest.java:216)
From the debugger, it looks like a SqlKind.REINTERPRET operator gets generated by the SqlToRelConverter, and nothing knows how to handle that unparsing to SQL.
Attachments
Issue Links
- duplicates
-
CALCITE-3312 TIMESTAMPDIFF cannot be converted to SQL
- In Progress