You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Kurt Young (Jira)" <ji...@apache.org> on 2019/12/03 02:29:00 UTC

[jira] [Assigned] (FLINK-14970) Doomed test for equality to NaN

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

Kurt Young reassigned FLINK-14970:
----------------------------------

    Assignee: Dezhi Cai

> Doomed test for equality to NaN
> -------------------------------
>
>                 Key: FLINK-14970
>                 URL: https://issues.apache.org/jira/browse/FLINK-14970
>             Project: Flink
>          Issue Type: Bug
>          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: Critical
>              Labels: pull-request-available
>         Attachments: image-2019-11-27-16-51-00-150.png, image-2019-11-27-16-51-06-801.png
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> scala pattern matching can't handle "NaN","NegativeInfinity " etc.
> in GenerateUtils, CodeGenerator, some code logic fall into this issue, 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 Float.NegativeInfinity => println("Float.NegativeInfinity")
>     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 value if value.isNegInfinity  => println("Float.NegativeInfinity")
>     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)