[
https://issues.apache.org/jira/browse/CALCITE-4407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17235247#comment-17235247
]
Danny Chen commented on CALCITE-4407:
-------------------------------------
Current interface {{SqlCall#getOperator}} only requires returning
{{SqlOperator}} instance, but the {{SqlShuttle}} always invokes
{{SqlOperator#createCall}}, which requires that the operator of {{SqlNode}}
must implement the {{createCall}} correctly.
The contract is very obscure, people can only find the problem when they use
the {{SqlShuttle}}.
I would suggest to strength the {{SqlCall}} of all the {{SqlNode}} instances to
return a specific {{SqlOperator}}, it always needs to implement the
{{#createCall}} correctly.
> Support unparse special syntax when operator is DELETE
> ------------------------------------------------------
>
> Key: CALCITE-4407
> URL: https://issues.apache.org/jira/browse/CALCITE-4407
> Project: Calcite
> Issue Type: Wish
> Reporter: xzh_dz
> Priority: Major
> Labels: pull-request-available
> Attachments: image-2020-11-18-16-12-18-340.png
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> This exception can be reproduced as below:
> SqlParserTest:
> {code:java}
> // code placeholder
> @Test void testSqlDeleteSqlBasicCallToString() throws Exception {
> final String sql0 = "delete from emps";
> final SqlNode sqlNode0 = getSqlParser(sql0).parseStmt();
> final SqlNode sqlNodeVisited0 = sqlNode0.accept(new SqlShuttle() {
> @Override public SqlNode visit(SqlIdentifier identifier) {
> return new SqlIdentifier(identifier.names,
> identifier.getParserPosition());
> }
> });
> System.out.println(sqlNodeVisited0.toString());
> }{code}
> Exception:
> {code:java}
> // code placeholder
> java.lang.UnsupportedOperationException: class
> org.apache.calcite.sql.SqlSyntax$7:
> SPECIALjava.lang.UnsupportedOperationException: class
> org.apache.calcite.sql.SqlSyntax$7: SPECIAL
> at org.apache.calcite.util.Util.needToImplement(Util.java:1080) at
> org.apache.calcite.sql.SqlSyntax$7.unparse(SqlSyntax.java:128) at
> org.apache.calcite.sql.SqlOperator.unparse(SqlOperator.java:377) at
> org.apache.calcite.sql.SqlDialect.unparseCall(SqlDialect.java:453) at
> org.apache.calcite.sql.SqlCall.unparse(SqlCall.java:103) at
> org.apache.calcite.sql.SqlNode.toSqlString(SqlNode.java:155)
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)