NarekDW opened a new pull request, #40040:
URL: https://github.com/apache/spark/pull/40040

   ### What changes were proposed in this pull request?
   This PR proposes to use `BigInt` instead of `Long` datatype for  conversion 
of numbers between different radixes, because of this we will get rid of 
overflows.
   This change allows to convert big numbers, like:
   ```
   spark-sql> SELECT 
CONV(SUBSTRING('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
 3), 16, 10);
   ```
   will give correct result:
   
`115792089237316195423570985008687907853269984665640564039457584007913129639935`
   
   **P.S. According to the NumberConverterBenchmark it work faster with Java 8 
and slower with Java 11 and 17.
   You can check benchmark results.**
   
   
   ### Why are the changes needed?
   Changes allow to convert big numbers among different radixes.
   
   ### Does this PR introduce _any_ user-facing change?
   Users could convert big values by using `conv` function, without an overflow.
   
   ### How was this patch tested?
   By existing tests + an additional test cases were added to:
   
`sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/MathExpressionsSuite.scala`
   
`sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/NumberConverterSuite.scala`


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to