[
https://issues.apache.org/jira/browse/CALCITE-4608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17351914#comment-17351914
]
Amrish Lal commented on CALCITE-4608:
-------------------------------------
{quote}I'm not sure about removing {{isExact}} though, this flag is used to
discriminate if the {{SqlNumericLiteral}} is represented as a
{{SqlTypeName.DECIMAL}} or a {{SqlTypeName.DOUBLE}}, so I'm a bit concerned of
the potential side effects of this change.
{quote}
Wouldn't it be better to just set the {{SqlTypeName}} in constructor instead of
setting {{isExact? Also, I am wondering if there are built in limits for
}}{{SqlTypeName.DECIMAL}} and {{SqlTypeName.DOUBLE?}} Standard SQL statements
can have more than 16 digits after decimal point and conversion of that value
to {{java.lang.Double}} would be lossy.
> Fix NullPointerException in SqlNumericLiteral.isInteger()
> ---------------------------------------------------------
>
> Key: CALCITE-4608
> URL: https://issues.apache.org/jira/browse/CALCITE-4608
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.26.0
> Reporter: Amrish Lal
> Assignee: Ruben Q L
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.27.0
>
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> In 1.26, a NullPointerException is thrown in SqlNumericLiteral.isInteger(),
> due to "this.scale" being null. This can be reproduced by compiling SQL
> statement "SELECT * FROM testTable WHERE floatColumn >
> 1.7976931348623157E308".
> A null check was added through CALCITE-4199 to fix the NullPointerException;
> however, the root cause is that scale and precision are not being properly
> set in {{SqlLiteral.createApproxNumeric}} function which is called to handle
> {{APPROX_NUMERIC_LITERAL}} token.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)