[
https://issues.apache.org/jira/browse/CALCITE-6688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
TJ Banghart reassigned CALCITE-6688:
------------------------------------
Assignee: TJ Banghart
> 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
>
> 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)