[ 
https://issues.apache.org/jira/browse/CALCITE-1176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15217074#comment-15217074
 ] 

Julian Hyde commented on CALCITE-1176:
--------------------------------------

Look at how the existing calls do it. Some of them check monotonicity first. 
Some of them are calls to functions whose arguments are always literals (e.g. 
{{EXTRACT(HOUR FROM ts)}}, argument 0 is always a time interval, in this case 
{{HOUR}}).

Also, {{SqlOperatorBinding.isOperandNull}} (though I see it's not widely used).

> 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