Skip to content

Conversation

@chihyu0917
Copy link

Description

Motivation

AlignByDeviceOrderByLimitOffsetTest#orderByExpressionTest2 failed non-deterministically under NonDex
because the test assumed a fixed child-index order in the logical-plan tree.
When the planner inserts or reorders nodes (for example, adding an ExchangeNode before the first TopKNode), the original assertions either threw a ClassCastException or triggered an AssertionError.

Design and Implementation

  • Locating the root TopKNode: Added findRootTopK(DistributedQueryPlan), which iterates over every `FragmentInstance and returns the first child that is a TopKNode
  • Casting safety: Perform instanceof checks before casting, added assertNotNull for the root to fail fast if not found.
  • Exchange node counting: Calculate rootTopK.getChildren().stream().filter(n instanceof ExchangeNode).count() and assert it equals 3 instead of checking fixed indices (1,2,3)

Reproduce the error

mvn -pl iotdb-core/datanode edu.illinois:nondex-maven-plugin:2.1.7:nondex -Dtest=org.apache.iotdb.db.queryengine.plan.planner.distribution.AlignByDeviceOrderByLimitOffsetTest#orderByExpressionTest2

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.

Key changed/added classes (or packages if there are too many classes) in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant