[ 
https://issues.apache.org/jira/browse/CALCITE-6688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17897732#comment-17897732
 ] 

Steven Talbot commented on CALCITE-6688:
----------------------------------------

Thanks! I don't have the cycles right at the moment to submit a full fix (was 
able to find quick workaround). For now, I'd put this out there for anyone who 
wants to pick up.

> 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
>            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)

Reply via email to