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/04/09 14:30:04 UTC

[GitHub] [spark] ulysses-you commented on a change in pull request #32106: [SPARK-35005][SQL] Improve error msg if UTF8String concatWs length overflow

ulysses-you commented on a change in pull request #32106:
URL: https://github.com/apache/spark/pull/32106#discussion_r610672884



##########
File path: common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
##########
@@ -1009,7 +1009,8 @@ public static UTF8String concatWs(UTF8String separator, UTF8String... inputs) {
 
     // Allocate a new byte array, and copy the inputs one by one into it.
     // The size of the new array is the size of all inputs, plus the separators.
-    final byte[] result = new byte[numInputBytes + (numInputs - 1) * separator.numBytes];
+    int intNumInputBytes = Ints.checkedCast(numInputBytes + (numInputs - 1) * separator.numBytes);

Review comment:
       this code just follow the `concat` that do the same check.
   https://github.com/apache/spark/blob/c06758834e6192b1888b4a885c612a151588b390/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L974




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