You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "Hariomlokhande-coder (via GitHub)" <gi...@apache.org> on 2026/10/10 06:03:02 UTC
[PR] Fix IN predicates with an expression item routing only to some shards [shardingsphere]
Hariomlokhande-coder opened a new pull request, #40129:
URL: https://github.com/apache/shardingsphere/pull/40129
Fixes #40128.
Changes proposed in this pull request:
- `ConditionValueInOperatorGenerator` now returns no sharding condition when an IN item can't be evaluated (e.g. `2 + 2`, `ABS(-4)` or `? + 0`), the same way `ConditionValueCompareOperatorGenerator` handles `=`. Before, those items were skipped and the statement was routed only to the shards of the remaining values, so `IN (1, 2 + 2)` returned only 1 and an UPDATE with that predicate changed only one row. `NOW()` items are still resolved through the timestamp service, and IN lists with only literals or parameters route as before.
- Adds two cases to `ConditionValueInOperatorGeneratorTest` (a literal plus an expression, and a parameter plus a parameter expression). Both fail without the fix.
- Adds a Bug Fixes entry to `RELEASE-NOTES.md`.
- Ran `ConditionValueInOperatorGeneratorTest`, the full `features/sharding/core` tests (896) and the router/rewriter ITs (`ShardingSQLRouterIT`, `ShardingSQLRewriterIT` and the rest, 1044 cases), all passing. Spotless and Checkstyle (`-Pcheck`) are clean for the changed files. Against the H2 driver fixture from the issue, `IN (1, 2 + 2)`, `IN (1, ABS(-4))`, `IN (?, ? + 0)` and the UPDATE now return or touch orders 1 and 4.
---
Before committing this PR, I'm sure that I have checked the following options:
- [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
- [x] 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.
- [x] I have added corresponding unit tests for my changes.
- [x] I have updated the Release Notes of the current development version. For more details, see [Update Release Note](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/)
- [ ] I have disclosed the tool and affected files or scope for any material AI assistance, as required by the [AI-assisted contribution policy].
[AI-assisted contribution policy]: https://github.com/apache/shardingsphere/blob/master/AI_POLICY.md
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix IN predicates with an expression item routing only to some shards [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu merged PR #40129:
URL: https://github.com/apache/shardingsphere/pull/40129
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org