You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "JackieTien97 (via GitHub)" <gi...@apache.org> on 2026/08/31 12:28:14 UTC
[PR] Fix flaky PARTIAL/FINAL plan assertion in rateFunctionsNormalTest [iotdb]
JackieTien97 opened a new pull request, #18556:
URL: https://github.com/apache/iotdb/pull/18556
## Description
`IoTDBTableAggregation2IT.rateFunctionsNormalTest` (inherited from `IoTDBTableAggregationIT`) fails sporadically:
```
Expected a PARTIAL aggregation in plan: { ... "Step": "SINGLE" ... "RegionId": "3", "DeviceNumber": "8" ... }
```
### Root cause
`assertRateQueryUsesIntermediateAggregation` unconditionally requires the `EXPLAIN (FORMAT JSON)` output of an ungrouped `rate()/increase()/irate()/delta()` query over `rate_merge_test` to contain a `PARTIAL`/`FINAL` two-step aggregation. That split only exists when the scanned data spans more than one DataRegion.
`IoTDBTableAggregation2IT` runs with `data_partition_allocation_strategy = SHUFFLE`. `PartitionBalancer.shuffleAllocationStrategy` assigns each (seriesSlot, timeSlot) to a **random** DataRegionGroup, and all 8 rows of `rate_merge_test` fall into one time partition. So occasionally all 8 devices land in the same DataRegion; the planner then correctly produces a `SINGLE`-step aggregation with one `DeviceTableScanNode`, and the assertion fails even though both the plan and the query result are correct (the result comparison right before the assertion had already passed).
### Fix
Count the distinct `RegionId` values in the JSON plan first. Skip the `PARTIAL`/`FINAL` check when the plan scans fewer than two distinct regions (a `SINGLE` aggregation is the correct plan there), and keep asserting it whenever the data actually spans multiple regions — which preserves the original intent of the check in the deterministic base-class environment (`CUSTOM` extension policy with 2 DataRegions per DataNode).
### Verification
- `IoTDBTableAggregationIT#rateFunctionsNormalTest` and `IoTDBTableAggregation2IT#rateFunctionsNormalTest` pass locally (TableSimpleIT).
- The region-count regex was verified against the single-region failing plan shape (count 1 → skip), a multi-region shape (count 2 → assert), and `"RegionId": "Not Assigned"` (count 0 → skip).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix flaky PARTIAL/FINAL plan assertion in rateFunctionsNormalTest [iotdb]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #18556:
URL: https://github.com/apache/iotdb/pull/18556#issuecomment-5478891295
## [Codecov](https://app.codecov.io/gh/apache/iotdb/pull/18556?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 42.33%. Comparing base ([`7a38e7e`](https://app.codecov.io/gh/apache/iotdb/commit/7a38e7e225fdd58a970710018e70d5614400719c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`1e54da9`](https://app.codecov.io/gh/apache/iotdb/commit/1e54da95f998cc80d07113f1c2688a7bbe9ceb6f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #18556 +/- ##
============================================
- Coverage 42.34% 42.33% -0.01%
Complexity 413 413
============================================
Files 5411 5411
Lines 390231 390231
Branches 51071 51071
============================================
- Hits 165233 165221 -12
- Misses 224998 225010 +12
```
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/iotdb/pull/18556?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix flaky PARTIAL/FINAL plan assertion in rateFunctionsNormalTest [iotdb]
Posted by "JackieTien97 (via GitHub)" <gi...@apache.org>.
JackieTien97 merged PR #18556:
URL: https://github.com/apache/iotdb/pull/18556
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org