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 13:27:32 UTC

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

maropu commented on a change in pull request #32106:
URL: https://github.com/apache/spark/pull/32106#discussion_r610625331



##########
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:
       Why did you use guava here instead of just checking `numInputBytes` > `Int.MaxValue`?




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