You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "gerashegalov (via GitHub)" <gi...@apache.org> on 2023/11/18 20:43:49 UTC

Re: [PR] [SPARK-44973][SQL] Fix `ArrayIndexOutOfBoundsException` in `conv()` [spark]

gerashegalov commented on code in PR #43880:
URL: https://github.com/apache/spark/pull/43880#discussion_r1398269455


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/NumberConverter.scala:
##########
@@ -23,6 +23,13 @@ import org.apache.spark.unsafe.types.UTF8String
 
 object NumberConverter {
 
+  /**
+   * The output string has a max length of one char per bit in the intermediate representation plus
+   * one char for the '-' sign.  This corresponds to the representation of `Long.MinValue` with
+   * `toBase` equal to -2.
+   */
+  private final val MAX_OUTPUT_LENGTH = 64 + 1

Review Comment:
   Since decoding is done via a Long interpreted as an unsigned long with an external `-` sign, 
   64 + 1 or `java.lang.Long.SIZE + 1`  is intuitive



-- 
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-unsubscribe@spark.apache.org

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