-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-23976][Core] Detect length overflow in UTF8String.concat()/ByteArray.concat() #21064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Test build #89338 has finished for PR 21064 at commit
|
|
ping @hvanhovell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - merging to master.
|
@hvanhovell seems this accidentally not get merged? |
|
ping @hvanhovell |
1 similar comment
|
ping @hvanhovell |
hvanhovell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - merging to master. Thanks!
|
@kiszk sorry about the delay. |
|
shall we backport it to 2.3? |
…eArray.concat() apache#21064 This PR detects length overflow if total elements in inputs are not acceptable. For example, when the three inputs has 0x7FFF_FF00, 0x7FFF_FF00, and 0xE00, we should detect length overflow since we cannot allocate such a large structure on byte[]. On the other hand, the current algorithm can allocate the result structure with 0x1000-byte length due to integer sum overflow.
…)/ByteArray.concat() apache#21064 This PR detects length overflow if total elements in inputs are not acceptable. For example, when the three inputs has 0x7FFF_FF00, 0x7FFF_FF00, and 0xE00, we should detect length overflow since we cannot allocate such a large structure on byte[]. On the other hand, the current algorithm can allocate the result structure with 0x1000-byte length due to integer sum overflow.
…erflow ### What changes were proposed in this pull request? Add check if the byte length over `int`. ### Why are the changes needed? We encounter a very extreme case with expression `concat_ws`, and the error msg is ``` Caused by: java.lang.NegativeArraySizeException at org.apache.spark.unsafe.types.UTF8String.concatWs ``` Seems the `UTF8String.concat` has already done the length check at [#21064](#21064), so it's better to add in `concatWs`. ### Does this PR introduce _any_ user-facing change? Yes ### How was this patch tested? It's too heavy to add the test. Closes #32106 from ulysses-you/SPARK-35005. Authored-by: ulysses-you <[email protected]> Signed-off-by: Max Gekk <[email protected]>
…erflow ### What changes were proposed in this pull request? Add check if the byte length over `int`. ### Why are the changes needed? We encounter a very extreme case with expression `concat_ws`, and the error msg is ``` Caused by: java.lang.NegativeArraySizeException at org.apache.spark.unsafe.types.UTF8String.concatWs ``` Seems the `UTF8String.concat` has already done the length check at [#21064](apache/spark#21064), so it's better to add in `concatWs`. ### Does this PR introduce _any_ user-facing change? Yes ### How was this patch tested? It's too heavy to add the test. Closes #32106 from ulysses-you/SPARK-35005. Authored-by: ulysses-you <[email protected]> Signed-off-by: Max Gekk <[email protected]>
What changes were proposed in this pull request?
This PR detects length overflow if total elements in inputs are not acceptable.
For example, when the three inputs has
0x7FFF_FF00,0x7FFF_FF00, and0xE00, we should detect length overflow since we cannot allocate such a large structure onbyte[].On the other hand, the current algorithm can allocate the result structure with
0x1000-byte length due to integer sum overflow.How was this patch tested?
Existing UTs.
If we would create UTs, we need large heap (6-8GB). It may make test environment unstable.
If it is necessary to create UTs, I will create them.