You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2024/11/22 21:56:00 UTC

[jira] [Updated] (CALCITE-6688) GREATEST/LEAST operators NPE in RexCall.equals

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

ASF GitHub Bot updated CALCITE-6688:
------------------------------------
    Labels: pull-request-available  (was: )

> GREATEST/LEAST operators NPE in RexCall.equals
> ----------------------------------------------
>
>                 Key: CALCITE-6688
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6688
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Steven Talbot
>            Assignee: TJ Banghart
>            Priority: Major
>              Labels: pull-request-available
>
> They are defined as symmetric in SqlKind.SYMMETRICAL. I didn't look at the other kinds in that set–they might have the same bug.
> But by being in that set, they fall through [https://github.com/apache/calcite/blob/8b4136bbd183f10e72c2ec02bef9caf1748631c2/core/src/main/java/org/apache/calcite/rex/RexNormalize.java#L93.]
> And then hit [https://github.com/apache/calcite/blob/8b4136bbd183f10e72c2ec02bef9caf1748631c2/core/src/main/java/org/apache/calcite/rex/RexNormalize.java#L102]
> But SqlStdLibraryOperators.GREATEST/LEAST do not have a `reverse` defined, so that throws a NullPointerException.
> Test code is something as simple as
>  
> {code:java}
> val b = RelBuilder.create(Frameworks.newConfigBuilder().build())
> val t = b.getTypeFactory().createUnknownType()
> val r1 = RexInputRef(1, t)
> val r2 = RexInputRef(2, t)
> b.call(SqlLibraryOperators.GREATEST, r1, r2).equals(b.call(SqlLibraryOperators.GREATEST, r2, r1)){code}
>  
>  
>  



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