Skip to content

[CALCITE-7432] NumberFormatException when convert NaN literal to sql#4838

Merged
xuzifu666 merged 1 commit intoapache:mainfrom
Dwrite:calcite-7432
Mar 19, 2026
Merged

[CALCITE-7432] NumberFormatException when convert NaN literal to sql#4838
xuzifu666 merged 1 commit intoapache:mainfrom
Dwrite:calcite-7432

Conversation

@Dwrite
Copy link

@Dwrite Dwrite commented Mar 15, 2026

SqlImplementor.toSql throws NumberFormatException when a RexLiteral contains a NaN or Infinity value, because BigDecimal cannot represent IEEE 754 special values. Fix by generating CAST('NaN' AS <type>) for non-finite doubles instead of calling SqlLiteral.createApproxNumeric.

Copy link
Member

@xiedeyantu xiedeyantu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only left some comments on coding style.

@mihaibudiu
Copy link
Contributor

This has 3 approvals, so after you address the comments and squash the commits let's merge it.

@mihaibudiu mihaibudiu added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Mar 17, 2026
@sonarqubecloud
Copy link

@xiedeyantu
Copy link
Member

I think we can merge this pr now.

@xuzifu666 xuzifu666 merged commit bbd083f into apache:main Mar 19, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LGTM-will-merge-soon Overall PR looks OK. Only minor things left.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants