You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Benoit Hanotte (JIRA)" <ji...@apache.org> on 2019/01/03 18:23:00 UTC
[jira] [Updated] (CALCITE-2767) Invalid operands for Case operator
in RexSqlStandardConvertletTable
[ https://issues.apache.org/jira/browse/CALCITE-2767?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benoit Hanotte updated CALCITE-2767:
------------------------------------
Description:
`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(val1) THEN val2 ... ELSE val3 END{code}
and never the form
{code:java}
CASE val WHEN cond1 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]
was:
`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 `CASE WHEN condition1(val1) THEN val2 ... ELSE val3 END` and never the form `CASE val WHEN cond1 THEN val2 ELSE val3`.
When calling `SqlCaseOperator.createCall()`, it needs to pass a null sql node for 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
> 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(val1) THEN val2 ... ELSE val3 END{code}
> and never the form
> {code:java}
> CASE val WHEN cond1 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)