PDGGK commented on PR #19105: URL: https://github.com/apache/iotdb/pull/19105#issuecomment-6598991360
Thanks for picking this up. I tried this change and hit one edge case: when the last window is `Long.MAX_VALUE`, the query never finishes. `nextDateBin` saturates at `Long.MAX_VALUE`, so after `fillGaps` writes the gap row at `endTime == Long.MAX_VALUE`, `currentTime` stays equal to `endTime`. With `<=`, `hasRemainingGapInPreviousGroup()` stays true, so `next()` fills the same window again on every call. The `currentTime <= previousTime` check in `fillGaps` only ends that one call. To reproduce it, I built `calc-commons` from v2.0.11 with the gapfill files from master, with and without this change, and ran each on the `apache/iotdb:2.0.11-standalone` image. Rows this large need `timestamp_precision_check_enabled=false`. ```sql CREATE DATABASE db1; CREATE TABLE db1.t (time TIMESTAMP TIME, d STRING TAG, v DOUBLE FIELD); INSERT INTO db1.t(time, d, v) VALUES (9223372036854775806, 'd2', 2.0); SELECT date_bin_gapfill(1ms, time) AS w, AVG(v) AS a FROM db1.t WHERE time >= 9223372036854775805 AND time <= 9223372036854775807 GROUP BY 1; ``` Without the change it returns two rows, so the last window is missing, as in #18988. With the change it keeps returning the null row for the last window. When I cut the output off at 300 KB, that row had been repeated 7,861 times. Driving the operator directly in a unit test gives the same result: it does not finish. One way to avoid it is to remember when `nextTime()` did not move `currentTime` forward, and stop filling from then on. That would also fix a related case that is already on master: when a group has a real row at `Long.MAX_VALUE` and another group follows, the group switch in `next()` adds a gap row at the same time right after the real row. Also, the description mentions a regression test, but the PR only changes `AbstractGapFillOperator.java`. Maybe it wasn't pushed? -- 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]
