uros-b commented on code in PR #56746:
URL: https://github.com/apache/spark/pull/56746#discussion_r3468383614
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionExpressionsSuite.scala:
##########
@@ -923,6 +923,10 @@ class CollectionExpressionsSuite
checkEvaluation(Slice(a1, Literal(1), Literal(2)), Seq("a", "b"))
checkEvaluation(Slice(a2, Literal(1), Literal(2)), Seq("", null))
checkEvaluation(Slice(a0, Literal(10), Literal(1)), Seq.empty[Int])
+ // SPARK-57665: a large length must not overflow startIndex + length; both
the interpreted and
+ // codegen paths must return the tail of the array, not an empty array.
+ checkEvaluation(Slice(a0, Literal(2), Literal(Int.MaxValue)), Seq(2, 3, 4,
5, 6))
+ checkEvaluation(Slice(a0, Literal(1), Literal(Int.MaxValue)), Seq(1, 2, 3,
4, 5, 6))
Review Comment:
The two added checkEvaluation cases (which exercise both interpreted and
codegen) correctly target positive start. Consider adding one case with a
negative start plus a large length (e.g. Slice(a0, Literal(-2),
Literal(Int.MaxValue)) => Seq(5, 6)), which exercises the start < 0 branch of
sliceStartIndex together with the clamping.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]