Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Seperate the logical plan optimization rule from core to storage engine #836

Merged

Conversation

penghuo
Copy link
Contributor

@penghuo penghuo commented Nov 19, 2020

Why making the change

The PR seperate the logical plan optimization into two categories.

  1. Pure relation operator optimization which independent of storage engine.
  2. Storage engine related optimization. e.g. In Elasticsearch, the aggregation operator could merge with relation operator as IndexAgg operator which is sepeific to Elasticsearch.

Description of changes

Add the new optimize function to Table, the storage could override this interface to perform customized optimization. By default, there is no optimization.

  default LogicalPlan optimize(LogicalPlan plan) {
    return plan;
  }

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@penghuo penghuo added the enhancement New feature or request label Nov 19, 2020
@penghuo penghuo self-assigned this Nov 19, 2020
@codecov
Copy link

codecov bot commented Nov 19, 2020

Codecov Report

Merging #836 (09d726b) into develop (35a76e8) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop     #836      +/-   ##
=============================================
- Coverage      99.84%   99.84%   -0.01%     
+ Complexity      2107     2093      -14     
=============================================
  Files            207      209       +2     
  Lines           4657     4654       -3     
  Branches         298      300       +2     
=============================================
- Hits            4650     4647       -3     
  Misses             5        5              
  Partials           2        2              
Impacted Files Coverage Δ Complexity Δ
...rch/sql/analysis/ExpressionReferenceOptimizer.java 100.00% <ø> (ø) 7.00 <0.00> (ø)
...relasticsearch/sql/planner/DefaultImplementor.java 100.00% <ø> (ø) 15.00 <0.00> (-2.00)
...sticsearch/sql/planner/logical/LogicalPlanDSL.java 100.00% <ø> (ø) 15.00 <0.00> (-3.00)
...ch/sql/planner/logical/LogicalPlanNodeVisitor.java 100.00% <ø> (ø) 15.00 <0.00> (-2.00)
...pendistroforelasticsearch/sql/planner/Planner.java 100.00% <100.00%> (ø) 4.00 <0.00> (ø)
...ch/sql/planner/optimizer/LogicalPlanOptimizer.java 100.00% <100.00%> (ø) 7.00 <1.00> (ø)
.../opendistroforelasticsearch/sql/storage/Table.java 100.00% <100.00%> (ø) 1.00 <1.00> (?)
.../planner/logical/ElasticsearchLogicalIndexAgg.java 100.00% <100.00%> (ø) 2.00 <1.00> (?)
...planner/logical/ElasticsearchLogicalIndexScan.java 100.00% <100.00%> (ø) 2.00 <1.00> (?)
...ical/ElasticsearchLogicalPlanOptimizerFactory.java 100.00% <100.00%> (ø) 1.00 <1.00> (?)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 35a76e8...f0355e6. Read the comment docs.

@penghuo penghuo changed the title seperate the logical plan from core to storage engine Seperate the logical plan optimization rule from core to storage engine Nov 19, 2020
Copy link
Member

@dai-chen dai-chen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

@penghuo penghuo merged commit 2bb05fc into opendistro-for-elasticsearch:develop Nov 20, 2020
penghuo added a commit that referenced this pull request Dec 15, 2020
…ne (#836)

* seperate the logical plan from core to storage engine

* add comments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants