uros-b commented on code in PR #59239:
URL: https://github.com/apache/spark/pull/59239#discussion_r4195663869


##########
sql/core/src/test/scala/org/apache/spark/sql/BinBySuite.scala:
##########
@@ -428,6 +430,32 @@ class BinBySuite extends QueryTest with SharedSparkSession 
{
     }
   }
 
+  test("BIN BY raises an overflow when the next bin index is not 
representable") {

Review Comment:
   This only exercises the `rs == re` arm (`BinByExec` ~122-130). The iterator 
arm (~132-152) still computes `k + 1` and then `k += 1` with no overflow check, 
so a non-empty range whose next grid index is not representable can still wrap 
to `Long.MinValue` and emit `bin_end < bin_start`.
   
   Please add a second case that actually enters that iterator (non-empty range 
at `Long.MaxValue`, or `ALIGN TO` before 1970 with a 1-microsecond width) and 
asserts the same overflow.



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

Reply via email to