-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[only test] " [featrue](expr) support common subexpression elimination" #32770
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
11 commits
Select commit
Hold shift + click to select a range
42d36b5
cse
englefly 72471ac
TODO required slot
englefly 659e048
fmt
englefly 0ce4653
fix-ut
englefly 089a62c
remove fake case
Mryange e04606d
be upd
Mryange 39eed1d
refine be code
Mryange 2e35d0b
upd thrift
Mryange c0c9a72
fe code refine
Mryange 7e48d68
be code refine
Mryange ea683d4
add some case
Mryange 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
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -135,6 +135,9 @@ class PipelineXLocalStateBase { | |||||
| RuntimeState* _state = nullptr; | ||||||
| vectorized::VExprContextSPtrs _conjuncts; | ||||||
| vectorized::VExprContextSPtrs _projections; | ||||||
| // Used in common subexpression elimination to compute intermediate results. | ||||||
| std::vector<vectorized::VExprContextSPtrs> _intermediate_projections; | ||||||
|
|
||||||
| bool _closed = false; | ||||||
| vectorized::Block _origin_block; | ||||||
| }; | ||||||
|
|
@@ -155,6 +158,22 @@ class OperatorXBase : public OperatorBase { | |||||
| if (tnode.__isset.output_tuple_id) { | ||||||
| _output_row_descriptor.reset(new RowDescriptor(descs, {tnode.output_tuple_id}, {true})); | ||||||
| } | ||||||
| if (tnode.__isset.output_tuple_id) { | ||||||
| _output_row_descriptor = std::make_unique<RowDescriptor>( | ||||||
| descs, std::vector {tnode.output_tuple_id}, std::vector {true}); | ||||||
| } | ||||||
| if (!tnode.intermediate_output_tuple_id_list.empty()) { | ||||||
| DCHECK(tnode.__isset.output_tuple_id) << " no final output tuple id"; | ||||||
| // common subexpression elimination | ||||||
| DCHECK_EQ(tnode.intermediate_output_tuple_id_list.size(), | ||||||
| tnode.intermediate_projections_list.size()); | ||||||
| _intermediate_output_row_descriptor.reserve( | ||||||
| tnode.intermediate_output_tuple_id_list.size()); | ||||||
| for (auto output_tuple_id : tnode.intermediate_output_tuple_id_list) { | ||||||
| _intermediate_output_row_descriptor.push_back( | ||||||
| RowDescriptor(descs, std::vector {output_tuple_id}, std::vector {true})); | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| OperatorXBase(ObjectPool* pool, int node_id, int operator_id) | ||||||
|
|
@@ -247,6 +266,25 @@ class OperatorXBase : public OperatorBase { | |||||
| return _row_descriptor; | ||||||
| } | ||||||
|
|
||||||
| // input expr -> intermediate_projections[0] -> intermediate_projections[1] -> intermediate_projections[2] ... -> final projections -> output expr | ||||||
| // prepare _row_descriptor intermediate_row_desc[0] intermediate_row_desc[1] intermediate_row_desc.end() _output_row_descriptor | ||||||
|
|
||||||
| [[nodiscard]] const RowDescriptor& intermediate_row_desc(int idx) { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: method 'intermediate_row_desc' can be made const [readability-make-member-function-const]
Suggested change
|
||||||
| if (idx == 0) { | ||||||
| return intermediate_row_desc(); | ||||||
| } | ||||||
| DCHECK((idx - 1) < _intermediate_output_row_descriptor.size()); | ||||||
| return _intermediate_output_row_descriptor[idx - 1]; | ||||||
| } | ||||||
|
|
||||||
| [[nodiscard]] const RowDescriptor& projections_row_desc() const { | ||||||
| if (_intermediate_output_row_descriptor.empty()) { | ||||||
| return intermediate_row_desc(); | ||||||
| } else { | ||||||
| return _intermediate_output_row_descriptor.back(); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| [[nodiscard]] std::string debug_string() const override { return ""; } | ||||||
|
|
||||||
| virtual std::string debug_string(int indentation_level = 0) const; | ||||||
|
|
@@ -318,6 +356,10 @@ class OperatorXBase : public OperatorBase { | |||||
| std::unique_ptr<RowDescriptor> _output_row_descriptor = nullptr; | ||||||
| vectorized::VExprContextSPtrs _projections; | ||||||
|
|
||||||
| std::vector<RowDescriptor> _intermediate_output_row_descriptor; | ||||||
| // Used in common subexpression elimination to compute intermediate results. | ||||||
| std::vector<vectorized::VExprContextSPtrs> _intermediate_projections; | ||||||
|
|
||||||
| /// Resource information sent from the frontend. | ||||||
| const TBackendResourceProfile _resource_profile; | ||||||
|
|
||||||
|
|
||||||
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: method 'intermediate_row_desc' can be made const [readability-make-member-function-const]