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

Kurt Young closed FLINK-14970.
------------------------------
    Fix Version/s: 1.10.0
       Resolution: Fixed

master: 3e28aedbaa85710aab34c0abb3a3973d73f7f805

> Doomed test for equality to NaN
> -------------------------------
>
>                 Key: FLINK-14970
>                 URL: https://issues.apache.org/jira/browse/FLINK-14970
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Legacy Planner, Table SQL / Planner
>    Affects Versions: 1.8.2, 1.9.0, 1.9.1
>            Reporter: Dezhi Cai
>            Assignee: Dezhi Cai
>            Priority: Trivial
>              Labels: pull-request-available
>             Fix For: 1.10.0
>
>         Attachments: image-2019-11-27-16-51-00-150.png, 
> image-2019-11-27-16-51-06-801.png, image-2019-12-04-13-39-38-549.png, 
> image-2019-12-04-13-40-19-441.png, image-2019-12-04-13-55-14-117.png, 
> image-2019-12-04-13-56-14-815.png, image-2019-12-04-13-58-14-131.png, 
> image-2019-12-04-14-01-27-420.png, image-2019-12-06-17-31-13-627.png, 
> image-2019-12-06-17-31-22-230.png, image-2019-12-06-17-32-37-195.png
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> scala pattern matching can't handle "NaN".
> in GenerateUtils, CodeGenerator, some code logic fall into this issue(as 
> there is no way to get {{NaN}} out of {{BigDecimal,}}
> {{so the code does not cause any impact}}), please refer to
> the screenshot for details.
> {code:java}
> def main(args: Array[String]): Unit = {
>   val floatVaue = Float.NaN
>   floatVaue match {
>     case Float.NaN => println("Float.NaN")
>     case _ => println("not match")
>   }
> }
> will output: not match
> {code}
> {code:java}
> // this one works
> def main(args: Array[String]): Unit = {
>   val floatVaue = Float.NaN
>   floatVaue match {
>     case value if value.isNaN => println("Float.NaN")
>     case _ => println("not match")
>   }
> }
> will output: Float.NaN
> {code}
>  
>  
> org.apache.flink.table.planner.codegen.GenerateUtils
> !image-2019-11-27-16-51-06-801.png|width=723,height=257!
> org.apache.flink.table.codegen.CodeGenerator
> !image-2019-11-27-16-51-00-150.png|width=727,height=158!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to