[
https://issues.apache.org/jira/browse/CALCITE-2767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16733441#comment-16733441
]
Julian Hyde commented on CALCITE-2767:
--------------------------------------
Is there an end-to-end test that demonstrates this problem? I'm always
suspicious when a bug adds a small new test class. It implies that this area of
functionality has never been tested, whereas it's more likely that it is one
defect in an area that broadly works. Those "tiny tests" still need to be
maintained, but they don't get regular love because they are too limited in
scope and hard to find.
> Invalid operands for Case operator in RexSqlStandardConvertletTable
> -------------------------------------------------------------------
>
> Key: CALCITE-2767
> URL: https://issues.apache.org/jira/browse/CALCITE-2767
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.18.0
> Reporter: Benoit Hanotte
> Assignee: Julian Hyde
> Priority: Minor
>
> `SqlCaseOperator.createCall()` requires 4 operands [1]:
> # first value (i.e. CASE value WHEN...)
> # when condifitions (as SqlNodeList)
> # then values (as SqlNodeLists)
> # else value
> `RexSqlStandardConvertletTable` always only pass 3 arguments [2] as it uses
> the generic form such as
> {code:java}
> CASE WHEN condition1 THEN val2 ... ELSE val3 END{code}
> and never the form
> {code:java}
> CASE val WHEN condition1 THEN val2 ELSE val3{code}
> When calling `SqlCaseOperator.createCall()`, it needs to pass a null sql node
> for the first value in order to correctly provide the 4 expected arguments
> and not only the last 3.
> [1]
> [https://github.com/apache/calcite/blob/59b76701d9c805f51b0929577ca604fdbfe00b0b/core/src/main/java/org/apache/calcite/sql/fun/SqlCaseOperator.java#L288]
> [2]
> [https://github.com/apache/calcite/blob/59b76701d9c805f51b0929577ca604fdbfe00b0b/core/src/main/java/org/apache/calcite/rex/RexSqlStandardConvertletTable.java#L239]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)