timarmstrong opened a new pull request #32006:
URL: https://github.com/apache/spark/pull/32006


   
   ### What changes were proposed in this pull request?
   Use `java.lang.Long.divideUnsigned()` to do integer division in 
`NumberConverter` to avoid a bug in `unsignedLongDiv` that produced invalid 
results.
   
   ### Why are the changes needed?
   The previous results are incorrect, the result of the below query should be 
45012021522523134134555 
   ```
   scala> spark.sql("select conv('-10', 11, 7)").show(20, 150)
   +-----------------------+
   |       conv(-10, 11, 7)|
   +-----------------------+
   |4501202152252313413456|
   +-----------------------+
   scala> spark.sql("select hex(conv('-10', 11, 7))").show(20, 150)
   +----------------------------------------------+
   |                         hex(conv(-10, 11, 7))|
   +----------------------------------------------+
   |3435303132303231353232353233313334313334353600|
   +----------------------------------------------+```
   
   ### Does this PR introduce _any_ user-facing change?
   `conv()` will produce different results because the bug is fixed.
   
   ### How was this patch tested?
   Added a simple unit test.
   


-- 
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.

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