Calcite enable pushdown aggregation#3389
Conversation
Signed-off-by: Heng Qian <qianheng@amazon.com>
Signed-off-by: Heng Qian <qianheng@amazon.com>
Signed-off-by: Heng Qian <qianheng@amazon.com>
|
Please update the latest code and rerun all ITs and UTs locally. PR added and refactored many ITs and UTs. |
LantaoJin
left a comment
There was a problem hiding this comment.
I think we still need UT for pushdown features, it shouldn't be blocked by explain feature.
We can add a CalcitePushdownTest with following code for checking.
RelNode finalPlan = Frameworks.getPlanner(getConfig().build()).transform(0, RelTraitSet.createEmpty(), root);
String finalPlanString = RelOptUtil.dumpPlan("", finalPlan, SqlExplainFormat.TEXT, SqlExplainLevel.ALL_ATTRIBUTES);
| import org.opensearch.sql.opensearch.storage.OpenSearchIndex; | ||
|
|
||
| @Getter | ||
| public class CalciteLogicalOSIndexScan extends CalciteOSIndexScan { |
There was a problem hiding this comment.
minor: "OS" is not very convenient for searching classes. (It's fine to use it as a variable name). I think we can remove the "OS" in class name, so does in its parent class. We don't have other type of Index. Or keeping the full name "OpenSearch" also acceptable.
| import org.opensearch.sql.opensearch.storage.OpenSearchIndex; | ||
|
|
||
| /** Relational expression representing a scan of an OpenSearchIndex type. */ | ||
| public abstract class CalciteOSIndexScan extends TableScan { |
There was a problem hiding this comment.
ditto. rename to CalciteOpenSearchIndexScan or CalciteIndexScan
|
|
||
| @Override | ||
| public boolean add(PushDownAction pushDownAction) { | ||
| // Defense check. I never do push down to this context after aggregate push-down. |
| PushDownContext pushDownContext) { | ||
| super(cluster, traitSet, hints, table); | ||
| this.osIndex = requireNonNull(osIndex, "OpenSearch index"); | ||
| ; |
There was a problem hiding this comment.
remove it? format checker does not detect it?
There was a problem hiding this comment.
Seems "./gradlew spotlessApply" doesn't fix it.
| return newScan; | ||
| } catch (Exception e) { | ||
| if (LOG.isDebugEnabled()) { | ||
| LOG.debug("Cannot pushdown the aggregate {}", aggregate, e); |
There was a problem hiding this comment.
any reasons only add stacktrace in debug log?
There was a problem hiding this comment.
There are too many cases where there is unsupported pushdown aggreagte/filter and it will report such issue many times since Calcite will hit this rule many times in its optimizing processes.
Hence, we need to avoid log explosion by removing trackstrace in no debugging mode.
Signed-off-by: Heng Qian <qianheng@amazon.com>
…ine' into feature/calcite-engine-pushdown-agg
May need further investigation or implementation on getting the final optimized plan. |
…ine' into feature/calcite-engine-pushdown-agg
dcf2057
into
opensearch-project:feature/calcite-engine
* Change push down to logical index scan Signed-off-by: Heng Qian <qianheng@amazon.com> * Support Aggregate Push Down Signed-off-by: Heng Qian <qianheng@amazon.com> * Rebase and resolve conflict Signed-off-by: Heng Qian <qianheng@amazon.com> * Add TODO Signed-off-by: Heng Qian <qianheng@amazon.com> * Address comments Signed-off-by: Heng Qian <qianheng@amazon.com> --------- Signed-off-by: Heng Qian <qianheng@amazon.com>
* Change push down to logical index scan Signed-off-by: Heng Qian <qianheng@amazon.com> * Support Aggregate Push Down Signed-off-by: Heng Qian <qianheng@amazon.com> * Rebase and resolve conflict Signed-off-by: Heng Qian <qianheng@amazon.com> * Add TODO Signed-off-by: Heng Qian <qianheng@amazon.com> * Address comments Signed-off-by: Heng Qian <qianheng@amazon.com> --------- Signed-off-by: Heng Qian <qianheng@amazon.com> Signed-off-by: xinyual <xinyual@amazon.com>
Description
This PR include changes:
VARSAMPandVARPOPimplementation.Related Issues
Resolves #3332
./gradlew :integ-test:integTest --tests '*Calcite*IT'succeed locally.Check List
--signoff.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.