mihaibudiu opened a new pull request, #3589:
URL: https://github.com/apache/calcite/pull/3589

   I initially started with the goal of fixing just [CALCITE-3522], 
https://issues.apache.org/jira/browse/CALCITE-3522, which is limiting the size 
of decimal literals to 64 bits. The fix is to actually check the precision of 
the type system when rejecting a decimal literal. That's easy. I am not 
checking the scale, under the assumption that rounding is OK for literals but 
losing precision is not.
   
   However, fixing this problem unmasked a bunch of other bugs in handling 
large values, so in order to make the tests pass I had to also fix 
[CALCITE-6169], which is about incorrect casts between numeric values. There is 
still one case which is not handled, which is casts between decimal values that 
change the scale of the result, but I plan to do that in a separate PR (because 
I also have to think about it more.)
   
   You will notice that this fix re-enables some tests that were disabled a 
long time ago. I think that disabling failing tests is not a good practice, and 
should be avoided. There are still some disabled tests in these categories, but 
strictly fewer than before.
   
   I couldn't make this into 2 separate PRs that both keep all tests running. 
   
   I am not 100% happy with the code, in particular with the implementation of 
the new Expression `ConvertChecked`. The implementation (which is in the 
unparse method...) in fact just calls the existing code in `Primitive` which 
handles numeric casts. I think that's better than duplicating the code. There 
is already a very large number of places where these conversions are handled, 
which is shown by the many files that I had to patch.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to