You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/03/16 02:25:26 UTC

[GitHub] [spark] AngersZhuuuu commented on pull request #30350: [SPARK-33428][SQL] Conv UDF use BigInt to avoid Long value overflow

AngersZhuuuu commented on pull request #30350:
URL: https://github.com/apache/spark/pull/30350#issuecomment-799894002


   > I found a behavior change here.
   > 
   > Before this commit
   > 
   > ```
   > scala> sql("select conv(-100, 10, 10)").show(20, false)
   > +----------------------------------+
   > |conv(CAST(-100 AS STRING), 10, 10)|
   > +----------------------------------+
   > |18446744073709551516              |
   > +----------------------------------+
   > ```
   > 
   > After this commit
   > 
   > ```
   > scala> sql("select conv(-100, 10, 10)").show(20, false)
   > +------------------+
   > |conv(-100, 10, 10)|
   > +------------------+
   > |-100              |
   > +------------------+
   > ```
   > 
   > If the `toBase` is positive, the result is unsigned. It's a bit hard to reason about how to put a negative value into an unsigned value, but MySQL returns the same result as before this commit and the overflow behavior seems to be desirable. @AngersZhuuuu can you take a look?
   
   Got it. 


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org