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

Julian Hyde commented on CALCITE-7432:
--------------------------------------

The fix should do the right thing for all types and for all IEEE floating point 
special values (positive and negative infinity, positive and negative zero, 
subnormal values). Please link to other cases that have worked in support for 
NaN.

> NumberFormatException when convert `NaN` literal to sql
> -------------------------------------------------------
>
>                 Key: CALCITE-7432
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7432
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: DeepSink He
>            Assignee: krooswu
>            Priority: Minor
>
> SQL:
> {code:java}
> select cast('NaN' as DOUBLE){code}
> LogicalPlan:
> {code:java}
>    LogicalValues(tuples=[[{ NaN }]]){code}
>  
> when conver the logical plan to SQL throws:
> {code:java}
> Exception in thread "main" java.lang.NumberFormatException: Character N is 
> neither a decimal digit number, decimal point, nor "e" notation exponential 
> mark.
>     at java.base/java.math.BigDecimal.<init>(BigDecimal.java:629)
>     at java.base/java.math.BigDecimal.<init>(BigDecimal.java:518)
>     at java.base/java.math.BigDecimal.<init>(BigDecimal.java:924)
>     at 
> org.apache.calcite.sql.parser.SqlParserUtil.parseDecimal(SqlParserUtil.java:280)
>     at 
> org.apache.calcite.sql.SqlLiteral.createApproxNumeric(SqlLiteral.java:1009)
>     at 
> org.apache.calcite.rel.rel2sql.SqlImplementor.toSql(SqlImplementor.java:1598)
>     at 
> org.apache.calcite.rel.rel2sql.SqlImplementor.toSql(SqlImplementor.java:1550){code}
> BigDecimal not accept `NaN` string as constructor arguments.



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

Reply via email to