Query: Adds an environment variable for disabling the hybrid search query plan optimization#5120
Merged
microsoft-github-policy-service[bot] merged 4 commits intomasterfrom Apr 11, 2025
Conversation
2dacf1e to
534f66d
Compare
adityasa
reviewed
Apr 11, 2025
adityasa
reviewed
Apr 11, 2025
Maya-Painter
approved these changes
Apr 11, 2025
kirankumarkolli
approved these changes
Apr 11, 2025
Merged
3 tasks
1 task
microsoft-github-policy-service Bot
pushed a commit
that referenced
this pull request
May 6, 2025
…h to be disabled (#5171) ## Description #5120 enabled the switch to ask for the optimized query plan by default. However, the pipeline support for the optimized query plan is in #5121. This will lead to exceptions in the hybrid search query pipeline in version 3.49.0 if the SDK talks to a newer gateway that can return the optimized query plan. To prevent this, we change this optimization to be disabled by default. ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) Co-authored-by: Debdatta Kunda <87335885+kundadebdatta@users.noreply.github.com>
neildsh
added a commit
that referenced
this pull request
May 6, 2025
…h to be disabled (#5171) ## Description #5120 enabled the switch to ask for the optimized query plan by default. However, the pipeline support for the optimized query plan is in #5121. This will lead to exceptions in the hybrid search query pipeline in version 3.49.0 if the SDK talks to a newer gateway that can return the optimized query plan. To prevent this, we change this optimization to be disabled by default. ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) Co-authored-by: Debdatta Kunda <87335885+kundadebdatta@users.noreply.github.com>
1 task
microsoft-github-policy-service Bot
pushed a commit
that referenced
this pull request
May 6, 2025
…h to be disabled (#5174) This is a cherry-pick of #5171 ## Description #5120 enabled the switch to ask for the optimized query plan by default. However, the pipeline support for the optimized query plan is in #5121. This will lead to exceptions in the hybrid search query pipeline in version 3.49.0 if the SDK talks to a newer gateway that can return the optimized query plan. To prevent this, we change this optimization to be disabled by default. ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) Co-authored-by: Debdatta Kunda <87335885+kundadebdatta@users.noreply.github.com>
amanrao23
added a commit
to Azure/azure-sdk-for-js
that referenced
this pull request
May 9, 2025
…34222) ### Packages impacted by this PR @azure/cosmos ### Issues associated with this PR #34221 ### Describe the problem that is addressed by this PR 1. ***Add support for weighted RRF in hybrid search.*** We allow weights to be negative but the negative sign is used to signal that we should sort scores in ascending order for the corresponding component. The final WRRF score is then computed using the absolute value of the weight. In this approach, the sign of the weight indicates the interpretation of the ranking itself rather than directly affecting the calculated score: WRRF(d) = ∑ |w_i| × 1/(k + r_i'(d)) 2. ***Adds support for the optimized query plan*** Adds a QueryFeature that returns optimized query plan, effectively removing the need for rewriting orderByExpressions in the SDK. A flag `disableHybridSearchQueryPlanOptimization` is added to disable returning optimized query plan. This is done to ensure the query works as expected for older gateways. ### Are there test cases added in this PR? _(If not, why?)_ Yes ### Provide a list of related PRs _(if any)_ * Azure/azure-cosmos-dotnet-v3#5064 * Azure/azure-cosmos-dotnet-v3#5120 * Azure/azure-cosmos-dotnet-v3#5121 ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This change adds a configuration whose value will be read from the environment variable
AZURE_COSMOS_HYBRID_SEARCH_QUERYPLAN_OPTIMIZATION_DISABLED. If this evaluates to true, then the optimization for skipping the order by rewrite for hybrid search is disabled.The environment variable is read, and the value is propagated as an internally visible query request option. This is plumbed down in the query plan APIs where it is either used to populate the supported query features header in case of a gateway or it is used as a flag passed into ServiceInterop.
Type of change