dgd-contributor commented on a change in pull request #33459: URL: https://github.com/apache/spark/pull/33459#discussion_r677489071
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/NumberConverter.scala ########## @@ -49,12 +49,14 @@ object NumberConverter { */ private def encode(radix: Int, fromPos: Int, value: Array[Byte]): Long = { var v: Long = 0L - val bound = java.lang.Long.divideUnsigned(-1 - radix, radix) // Possible overflow once + // bound will always positive since radix >= 2 + val bound = java.lang.Long.divideUnsigned(-1 - radix, radix) var i = fromPos while (i < value.length && value(i) >= 0) { - if (v >= bound) { Review comment: I think the root of this misunderstanding problem is we treat a long value as an unsigned long value. I think we should introduce a new class of unsigned long value to provide the needed function such as comparing, checking for overflow... -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org