Skip to content

Optimize SQL rewrite token traversal#38796

Merged
strongduanmu merged 1 commit into
apache:masterfrom
FlyingZC:dev0604-rewrite
Jun 4, 2026
Merged

Optimize SQL rewrite token traversal#38796
strongduanmu merged 1 commit into
apache:masterfrom
FlyingZC:dev0604-rewrite

Conversation

@FlyingZC

@FlyingZC FlyingZC commented Jun 4, 2026

Copy link
Copy Markdown
Member

Fixes #ISSUSE_ID.

Changes proposed in this pull request:


Before committing this PR, I'm sure that I have checked the following options:

  • My code follows the code of conduct of this project.
  • I have self-reviewed the commit code.
  • I have (or in comment I request) added corresponding labels for the pull request.
  • I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e.
  • I have made corresponding changes to the documentation.
  • I have added corresponding unit tests for my changes.
  • I have updated the Release Notes of the current development version. For more details, see Update Release Note

@FlyingZC

FlyingZC commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

Decision

  • Merge Verdict: Mergeable
  • Reviewed Scope: PR Optimize route lookup and sharding table find #38794 latest head d17cbba0b5e05ff47890060f53653ecc73ce7c43, merge-base 908ff08cea2925d387983f42580c5fc493fe3228; local diff file list matched GitHub / pulls/38794/files. Reviewed features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java, infra/executor/src/main/java/org/apache/shardingsphere/ infra/executor/sql/prepare/driver/DriverExecutionPrepareEngine.java, and infra/route/core/src/main/java/org/apache/shardingsphere/infra/route/context/RouteUnit.java.
  • Not Reviewed Scope: GitHub Actions / CI status and full repository build.
  • Need Expert Review: No.

Basis

  • features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java:309 simplifies containsKey + get into one null-aware lookup. Existing missing-table
    and null-table-name behavior is preserved by the existing rule tests.
  • infra/route/core/src/main/java/org/apache/shardingsphere/infra/route/context/RouteUnit.java:85 hoists the datasource mismatch check before scanning table mappers. This keeps the same
    datasource-first matching semantics and avoids repeated invariant checks inside the loop.
  • infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/DriverExecutionPrepareEngine.java:97 and infra/executor/src/main/java/org/apache/ shardingsphere/infra/executor/sql/prepare/driver/DriverExecutionPrepareEngine.java:109 use pre-sized ArrayList for append-only lists whose target sizes are already known. Order and
    ExecutionGroup behavior are unchanged.

Verification

  • git diff --name-status $(git merge-base upstream/master upstream/pr/38794)..upstream/pr/38794 matched the GitHub file list.
  • git diff --check $(git merge-base upstream/master upstream/pr/38794)..upstream/pr/38794 passed with exit code 0.
  • ./mvnw -pl infra/route/core,features/sharding/core,infra/executor -am -DskipITs -Dspotless.skip=true -Dcheckstyle.skip=true -Dsurefire.failIfNoSpecifiedTests=false -Dtest=RouteUnitTest,RouteContextTest,ShardingRuleTest test passed with exit code 0.
  • Surefire confirmed RouteUnitTest 6 tests, RouteContextTest 11 tests, and ShardingRuleTest 71 tests passed with 0 failures/errors/skips.

@strongduanmu strongduanmu merged commit 7ead6df into apache:master Jun 4, 2026
79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants