Steven Talbot created CALCITE-6086:
--------------------------------------

             Summary: SqlImplementor does not properly handle SAFE_CAST
                 Key: CALCITE-6086
                 URL: https://issues.apache.org/jira/browse/CALCITE-6086
             Project: Calcite
          Issue Type: Bug
            Reporter: Steven Talbot


This blockĀ 

[https://github.com/apache/calcite/blob/782d327d24c04e2161102b22f8880204462befd4/core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java#L815]

needs to fire for the (added in 1.35.0) kind SqlKind.SAFE_CAST, or the 
SAFE_CAST does not work in SQL.

I could submit a repro if it's not obvious, but it should be as simple as 
something like 
`b.scan("emps").project(b.rexBuilder.makeAbstractCast(b.typeFactory.createSqlType(SqlTypeName.INTEGER),
 b.field(0), true))` and trying to write SQL from that. The second 
SqlDataTypeSpec argument won't get added, and it will fail the assertion error 
about two operands in SqlCastFunction.unparse



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to