[BugFix] Fix PushDownContext shallow copy bug#5199
[BugFix] Fix PushDownContext shallow copy bug#5199songkant-aws wants to merge 8 commits intoopensearch-project:mainfrom
Conversation
Signed-off-by: Songkan Tang <songkant@amazon.com>
PR Reviewer Guide 🔍(Review updated until commit 05a2ed2)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 05a2ed2 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit af6c695
Suggestions up to commit 11db491
Suggestions up to commit 84892bcSuggestions up to commit f36c20a
Suggestions up to commit 7df5f94
|
Signed-off-by: Songkan Tang <songkant@amazon.com>
|
Persistent review updated to latest commit 21f8940 |
|
cc @qianheng-aws as proper reviewer |
| if (builder instanceof NestedAggregationBuilder nested) { | ||
| return copyNestedAggregationBuilder(nested); | ||
| } | ||
| return builder; |
There was a problem hiding this comment.
What if there is other missed or upcoming agg builder?
| } | ||
| } | ||
|
|
||
| private static final class TermsAggregationBuilderCopy extends TermsAggregationBuilder { |
There was a problem hiding this comment.
Can this be replaced with
source.shallowCopy(source, copySubAggregations(source), copyMetadataOrNull(source))
instead of defining these extended class?
Signed-off-by: Songkan Tang <songkant@amazon.com>
|
Persistent review updated to latest commit 9fe5192 |
|
Persistent review updated to latest commit 7df5f94 |
Signed-off-by: Songkan Tang <songkant@amazon.com>
|
Persistent review updated to latest commit f36c20a |
Signed-off-by: Songkan Tang <songkant@amazon.com>
|
Persistent review updated to latest commit 84892bc |
|
Persistent review updated to latest commit 11db491 |
|
Persistent review updated to latest commit af6c695 |
|
@qianheng-aws Now the fix is changed to lazily push down agg request at the createRequest phase. But it introduces some intermediate immutable spec object to record any logical pushdown operations. It touches more logic now but I think it could mitigate the current problem of AggPushDownAction's mutation during planning. |
Signed-off-by: Songkan Tang <songkant@amazon.com>
af6c695 to
05a2ed2
Compare
|
Persistent review updated to latest commit 05a2ed2 |
Description
PushdownContext.clone() / cloneWithoutSort() / cloneForAggregate() replays add(operation) to construct new context. Aggregation operations reuses the same
AggPushDownActioninstance in both old and new context due to shallow copy side effect happened during cloning PushdownContext. The following pushdown actions from other equivalent RelSubsets will modify this shared mutable action object, which could contaminate previous context's agg states.Related Issues
Resolves #5125
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.