[CALCITE-4608] Fix NullPointerException in SqlNumericLiteral.isInteger()#2415
[CALCITE-4608] Fix NullPointerException in SqlNumericLiteral.isInteger()#2415amrishlal wants to merge 6 commits into
Conversation
|
Hi, seems a positive change, can you add a ut for this? |
OK, will do. |
|
@Aaaaaaron @julianhyde I have added the test case. Thanks. |
|
I suggest that squash the commits to one so that the history can be brief. |
|
Would it be possible to have a unit test "showing the issue"? i.e. a unit test that throws a NPE with the current master code, but that works fine with this patch. |
Hi, as I mentioned in the description, the NPE has already been fixed by CALCITE-4199 in master through a null check. This PR is making sure that scale and precision are being properly set. The test case that I added earlier validates that scale and precision are being properly set and also validates that NPE is no longer occurring. |
|
Use |
Done. |
|
Closing this PR based on discussion in CALCITE-4608. I will open a separate PR for modifications discussed in the Jira ticket. |
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.