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

Steve Carlin commented on CALCITE-4467:
---------------------------------------

Sorry if I was unclear, but it kinda made sense to me to reopen this issue.

This is actually the main issue I need fixed.  I worked with [~jcamacho] on 
this project, and I was able to get around this issue for a long time.  But it 
reared its head again, and my workaround is no longer sufficient.  So "Won't 
Fix" isn't an acceptable answer for me and I'd like to continue this discussion 
until I can get this solved.

This discussion here talks about how solving the NaN problem is just as hard as 
solving the NULL problem.  Which I totally get. 

I see [~julianhyde] 's comment of "If we assume that 'NaN' is not a possible 
value in Calcite, then we may close this JIRA as not an issue."

This strikes me as kind of funny though.  NaN is a value that many, if not all 
databases that use Calcite have to deal with, as the follow-up comment about 
CockroachDb, Oracle, and PostgreSQL mentions.  Not sure it makes sense for 
Calcite to play the ostrich defense on this one and just ignore its existence. 

As mentioned, creating a custom RexSimplify object would solve the problem, 
especially if I could derive from it and inherit most of the methods.  Maybe 
some kind of interface would solve this.  I've yet to do the research. But I'd 
rather get a green or a yellow light on this before conducting any research as 
to whether this is possible.

> Incorrect simplification for 'NaN' value
> ----------------------------------------
>
>                 Key: CALCITE-4467
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4467
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Jesús Camacho Rodríguez
>            Assignee: Jesús Camacho Rodríguez
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.27.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> {{RexSimplify}} simplifies {{x = x}} to {{null or x is not null}} (similarly 
> <= and >=), and {{x != x}} to {{null and x is null}} (similarly < and >).
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rex/RexSimplify.java#L363
> This may not be applicable in some cases. For instance, if the type of x is 
> floating-point, x could be 'NaN'. While some RDBMS consider 'NaN' = 'NaN' 
> (e.g., Postgres), some others consider 'NaN' != 'NaN' following the IEEE 754 
> standard. For the latest, the rewriting above will result in incorrect 
> results.
> I think we should simply ignore this simplification for floating-point type.



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

Reply via email to