fix bugs in DistributionPlannerCycleTest#timeJoinNodeTest #16721
+87
−53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Updates
DistributionPlannerCycleTest#timeJoinNodeTestso the assertions adapt to legitimate execution plans where the query planner decides no remote fragments are required. The test now inspects the node tree structurally, rather than by hard-coding child-list lengths, to stay valid on both single-node and multi-node layouts.Motivation
When all relevant data-regions for root.sg.d1 and root.sg.d2 happen to be located on the same DataNode, the planner quite correctly omits any cross-region ExchangeNodes for the second fragment.
The previous test expected a fixed fan-out (three children with one ExchangeNode) and therefore failed on clusters with that “all-local” layout or under NonDex permutation. The failure was in the test logic, not in the planner.
Design & Implementation
private static long countDirectChildrenOfType(PlanNode node, Class<?> clazz)counts only the immediate children of a given type, making the checks clearer.
Must still contain exactly one ExchangeNode (remote merge for d2).
Must contain at least two SeriesScanNodes.
Must contain zero ExchangeNodes – the all-local case is now valid.
The number of direct SeriesScanNodes is verified to be between 2 and 3 (inclusive).
No production code is affected; only the unit test is updated.
Reproduce the error
org.apache.iotdb.db.queryengine.plan.planner.distribution.DistributionPlannerCycleTest.timeJoinNodeTest -- Time elapsed: 1.485 s <<< FAILURE! java.lang.AssertionError: expected:<3> but was:<4>mvn -pl iotdb-core/datanode edu.illinois:nondex-maven-plugin:2.1.7:nondex -Dtest=org.apache.iotdb.db.queryengine.plan.planner.distribution.DistributionPlannerCycleTest#timeJoinNodeTest -DnondexRuns=10This PR has:
for an unfamiliar reader.
for code coverage.
Key changed/added classes (or packages if there are too many classes) in this PR