Copilot commented on code in PR #13144:
URL: https://github.com/apache/gluten/pull/13144#discussion_r4110694175
##########
gluten-core/src/test/scala/org/apache/gluten/iterator/IteratorSuite.scala:
##########
@@ -39,6 +39,25 @@ abstract class IteratorSuite extends AnyFunSuite {
}
}
+ test("Read time accumulation does not lose sub-millisecond reads") {
+ var totalMillis = 0L
+ val elementCount = 300000
+ val itr = Array.range(0, elementCount).iterator
+ val wrapped = wrap(itr)
+ .collectReadMillis(millis => totalMillis += millis)
+ .create()
+ var consumed = 0
+ while (wrapped.hasNext) {
+ wrapped.next()
+ consumed += 1
+ }
+ assert(consumed == elementCount)
+ // Each individual read takes well under a millisecond; converting per call
+ // used to truncate every duration to zero. The accumulated total over
+ // elementCount reads must be positive.
+ assert(totalMillis > 0L)
Review Comment:
This assertion is timing-dependent and does not actually guarantee that each
measured call is sub-millisecond: a scheduler pause or GC during any
`hasNext`/`next` can make the previous per-call implementation report a
positive value as well. That lets the regression pass without exercising
remainder carry-over. Please make the accumulator testable with an injected
clock (or otherwise feed deterministic nanosecond durations) and assert the
exact callback total across controlled sub-millisecond calls.
--
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]