iotdb
iotdb copied to clipboard
fix tests in ColumnInjectionPushDownTest
Fix Non-Deterministic Behavior in ColumnInjectionPushDownTest
Problem
Two tests were failing non-deterministically under NonDex with ~50% failure rate:
-
testCannotPushDownTimeJoinAlignByTime -
testPartialPushDownTimeJoinAlignByDevice
Reproduce
cd iotdb-core/datanode
mvn edu.illinois:nondex-maven-plugin:2.1.1:nondex \
-Dtest=ColumnInjectionPushDownTest#testCannotPushDownTimeJoinAlignByTime \
-DnondexRuns=4
Failure example: java.lang.AssertionError: expected:ColumnInjectNode@79d58e5b but was:ColumnInjectNode@d7938b9b
Root Cause
- HashMap in test utilities - Non-deterministic iteration order caused plan nodes to be constructed differently across runs
- Order-sensitive comparison in FullOuterTimeJoinNode - Children were compared as ordered lists, but join order doesn't affect semantic meaning
Solution
-
Test utilities: Replaced
HashMapwithLinkedHashMapto preserve insertion order-
OptimizationTestUtil.schemaMap -
OptimizationTestUtil.getAggregationDescriptor() - All
deviceToMeasurementIndexesMapin tests
-
-
Production code: Implemented order-independent
equals()inFullOuterTimeJoinNode- Children are now compared as sets rather than ordered lists
- Semantically correct since full outer time join order doesn't matter
Key Changed Classes
-
OptimizationTestUtil- HashMap → LinkedHashMap -
ColumnInjectionPushDownTest- HashMap → LinkedHashMap -
TestPlanBuilder- HashMap → LinkedHashMap -
FullOuterTimeJoinNode- Order-independent equals()
This PR has:
- [ ] been self-reviewed.
- [ ] concurrent read
- [ ] concurrent write
- [ ] concurrent read and write
- [ ] added documentation for new or modified features or behaviors.
- [ ] added Javadocs for most classes and all non-trivial methods.
- [ ] added or updated version, license, or notice information
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage.
- [ ] added integration tests.
- [ ] been tested in a test IoTDB cluster.