-
Notifications
You must be signed in to change notification settings - Fork 202
Add LogicalSystemLimit automatically for data-intensive operations #3749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
90eb072
Pushdown system limit automatically for data-intensive operations
LantaoJin f55d8de
fix TPCH IT
LantaoJin 02c1386
address comments
LantaoJin fddf273
fix typo
LantaoJin e885f9c
Merge remote-tracking branch 'upstream/main' into issues/3731
LantaoJin 42948a7
Merge remote-tracking branch 'upstream/main' into issues/3731
LantaoJin 835df88
Merge remote-tracking branch 'upstream/main' into issues/3731
LantaoJin abdac36
Refactor
LantaoJin 7a372f6
revert unused code
LantaoJin c6c7600
revert unused code
LantaoJin efde8b9
revert unused code
LantaoJin 29ee469
Fix IT
LantaoJin a03196c
Merge remote-tracking branch 'upstream/main' into issues/3731
LantaoJin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
65 changes: 65 additions & 0 deletions
65
core/src/main/java/org/opensearch/sql/calcite/plan/LogicalSystemLimit.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package org.opensearch.sql.calcite.plan; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import org.apache.calcite.plan.Convention; | ||
| import org.apache.calcite.plan.RelOptCluster; | ||
| import org.apache.calcite.plan.RelTraitSet; | ||
| import org.apache.calcite.rel.RelCollation; | ||
| import org.apache.calcite.rel.RelCollationTraitDef; | ||
| import org.apache.calcite.rel.RelNode; | ||
| import org.apache.calcite.rel.core.Sort; | ||
| import org.apache.calcite.rel.hint.RelHint; | ||
| import org.apache.calcite.rel.logical.LogicalSort; | ||
| import org.apache.calcite.rex.RexNode; | ||
| import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
|
||
| /** System level limit logical plan, comparing to user level plan {@link LogicalSort}. */ | ||
| public class LogicalSystemLimit extends Sort { | ||
|
|
||
| private LogicalSystemLimit( | ||
| RelOptCluster cluster, | ||
| RelTraitSet traitSet, | ||
| RelNode input, | ||
| RelCollation collation, | ||
| @Nullable RexNode offset, | ||
| @Nullable RexNode fetch) { | ||
| this(cluster, traitSet, Collections.emptyList(), input, collation, offset, fetch); | ||
| } | ||
|
|
||
| private LogicalSystemLimit( | ||
| RelOptCluster cluster, | ||
| RelTraitSet traitSet, | ||
| List<RelHint> hints, | ||
| RelNode input, | ||
| RelCollation collation, | ||
| @Nullable RexNode offset, | ||
| @Nullable RexNode fetch) { | ||
| super(cluster, traitSet, hints, input, collation, offset, fetch); | ||
| assert traitSet.containsIfApplicable(Convention.NONE); | ||
| } | ||
|
|
||
| public static LogicalSystemLimit create( | ||
| RelNode input, RelCollation collation, @Nullable RexNode offset, @Nullable RexNode fetch) { | ||
| RelOptCluster cluster = input.getCluster(); | ||
| collation = RelCollationTraitDef.INSTANCE.canonize(collation); | ||
| RelTraitSet traitSet = input.getTraitSet().replace(Convention.NONE).replace(collation); | ||
| return new LogicalSystemLimit(cluster, traitSet, input, collation, offset, fetch); | ||
| } | ||
|
|
||
| @Override | ||
| public Sort copy( | ||
| RelTraitSet traitSet, | ||
| RelNode newInput, | ||
| RelCollation newCollation, | ||
| @Nullable RexNode offset, | ||
| @Nullable RexNode fetch) { | ||
| return new LogicalSystemLimit( | ||
| getCluster(), traitSet, hints, newInput, newCollation, offset, fetch); | ||
| } | ||
| } |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.