Use safe in() lists for id collections in the variable queries - #4277
Merged
Merged
Conversation
The variable queries emitted a single flat in() clause for the id collections, which fails on databases that limit the number of entries in an in() clause (Oracle allows at most 1000). The id collections are now split into chunks of MAX_ENTRIES_IN_CLAUSE and combined with OR, the same way the historic variable query already did it for some of its filters. This covers taskIds, executionIds, scopeIds and subScopeIds on InternalVariableInstanceQuery, taskIds and executionIds on VariableInstanceQuery, and executionIds on HistoricVariableInstanceQuery, which was the last filter in that query still using a flat in() clause. The scopeTypes and names collections are not expected to exceed the limit and are left as they are. While there, the cached entity matcher now ignores empty scopeIds and subScopeIds collections, so it is consistent with the SQL, which skips the filter in that case.
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.
The variable queries emitted a single flat in() clause for the id collections, which fails on databases that limit the number of entries in an in() clause (Oracle allows at most 1000).
The id collections are now split into chunks of
MAX_ENTRIES_IN_CLAUSEand combined with OR, the same way the historic variable query already did it for some of its filters. This coverstaskIds,executionIds,scopeIdsandsubScopeIdsonInternalVariableInstanceQuery,taskIdsandexecutionIdsonVariableInstanceQuery, andexecutionIdsonHistoricVariableInstanceQuery, which was the last filter in that query still using a flat in() clause. ThescopeTypesandnamescollections are not expected to exceed the limit and are left as they are.While there, the cached entity matcher now ignores empty
scopeIdsandsubScopeIdscollections, so it is consistent with the SQL, which skips the filter in that case.