mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-26 04:09:50 -05:00
### Does this PR have any customer impact? Yes ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Bugfix ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) No ### Are you introducing any new config? If yes, do you have tests with and without them being set? Yes ### ChangeLog (Refer [Template](../oss/CHANGELOG.md)) ### Description In a distributed set up, shard keys specified with $and/$eq/$or were tracked but not $in. This adds support for $in as well in pushdown. ---- #### AI description (iteration 1) #### PR Classification New feature to enhance sharding by supporting pushdown of queries with shard keys specified using the $in operator. #### PR Summary This pull request extends the sharding logic to process $in operator predicates for shard keys, optimizing query routing and pushdown. - `oss/pg_documentdb/src/sharding/sharding.c`: Added new helper functions (e.g., FindShardKeyValuesExprPhase1, ConsiderShardKeyFiltersForInClauses, and FindShardKeyValuesExprNew) and refactored shard key handling to use a new `ShardKeyMetadata` structure with updated `setCount` tracking. - `oss/pg_documentdb/src/configs/feature_flag_configs.c`: Introduced the `UseNewShardKeyCalculation` flag to enable the new shard key calculation logic. - Test files and SQL regression scripts: Updated expected outputs and queries to validate the new $in operator support for shard key pushdown. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->