[
https://issues.apache.org/jira/browse/CALCITE-7432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18066669#comment-18066669
]
Yu Xu commented on CALCITE-7432:
--------------------------------
Fixed in
[bbd083f|https://github.com/apache/calcite/commit/bbd083fd6b0e55f3a13c142626adf03ffe0eb5e1]
Thank you for the suggestion [~julianhyde]
Thank you for the review [~mbudiu] [~jensen]
> 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: DongShengHe
> Assignee: krooswu
> Priority: Minor
> Labels: pull-request-available
>
> 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)