Sean Hsuan-Yi Chu created CALCITE-1176:
------------------------------------------

             Summary: The implementation of 
SqlOperatorBinding#getOperandLiteralValue does not strictly follow the contract
                 Key: CALCITE-1176
                 URL: https://issues.apache.org/jira/browse/CALCITE-1176
             Project: Calcite
          Issue Type: Improvement
          Components: core
            Reporter: Sean Hsuan-Yi Chu
            Assignee: Sean Hsuan-Yi Chu


As is pointed out in [1], if the operand is not a literal, the value returned 
by SqlOperatorBinding#getOperandLiteralValue is null.

However, the two implementations in RexCallBinding and SqlCallBinding do not 
really follow. From the implementation point of view, they will call other two 
utilities methods which could throw exceptions [2], [3]. 

[1] 
https://github.com/apache/calcite/blob/4c7f5c20a04b4a4e736a16f801d8b5e6eded48cc/core/src/main/java/org/apache/calcite/sql/SqlOperatorBinding.java#L119
[2] 
https://github.com/apache/calcite/blob/72b2cfb799242e0d1d7e6aed8bfe43cceb554c7c/core/src/main/java/org/apache/calcite/rex/RexLiteral.java#L645
[3]
https://github.com/apache/calcite/blob/4ac82a30b8ee7ae1afcd83c6f3ef687761536f2e/core/src/main/java/org/apache/calcite/sql/SqlLiteral.java#L335



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to