[ 
https://issues.apache.org/jira/browse/CALCITE-7195?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mihai Budiu resolved CALCITE-7195.
----------------------------------
    Fix Version/s: 1.41.0
         Assignee: Mihai Budiu
       Resolution: Fixed

Fixed in 
https://github.com/apache/calcite/commit/73c5400111b2ba502bf28d20aafbb609520ab56b
Thank you for the review [~asolimando]

> COALESCE type inference rejects legal arguments
> -----------------------------------------------
>
>                 Key: CALCITE-7195
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7195
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.40.0
>            Reporter: Mihai Budiu
>            Assignee: Mihai Budiu
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.41.0
>
>
> The following test fails in SqlValidatorTest:
> {code:java}
>     final String sql2 = "select coalesce(NULL, ARRAY[1])";
>     sql(sql2)
>         .withValidatorCallRewrite(false)
>         .ok();
> {code}
> The top of the stack trace is:
> {code}
> org.apache.calcite.sql.validate.SqlValidatorException: Parameters must be of 
> the same type
>       at 
> java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
>       at 
> java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
>       at 
> java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484)
>       at 
> org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:511)
>       at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:605)
>       at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:960)
>       at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:945)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:5960)
>       at 
> org.apache.calcite.sql.SqlCallBinding.newValidationError(SqlCallBinding.java:421)
>       at 
> org.apache.calcite.sql.type.SameOperandTypeChecker.checkOperandTypesImpl(SameOperandTypeChecker.java:102)
>       at 
> org.apache.calcite.sql.type.SameOperandTypeChecker.checkOperandTypes(SameOperandTypeChecker.java:61)
>       at 
> org.apache.calcite.sql.SqlOperator.checkOperandTypes(SqlOperator.java:784)
> {code}
> This bug is masked by the fact that in general the validator rewrites 
> COALESCE as CASE.



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

Reply via email to