-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[refactor](agg) Refactor agg-related metrics #42898
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
Merged
Merged
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,20 +30,18 @@ namespace doris::pipeline { | |
| AggLocalState::AggLocalState(RuntimeState* state, OperatorXBase* parent) | ||
| : Base(state, parent), | ||
| _get_results_timer(nullptr), | ||
| _serialize_result_timer(nullptr), | ||
| _hash_table_iterate_timer(nullptr), | ||
| _insert_keys_to_column_timer(nullptr), | ||
| _serialize_data_timer(nullptr) {} | ||
| _insert_values_to_column_timer(nullptr) {} | ||
|
|
||
| Status AggLocalState::init(RuntimeState* state, LocalStateInfo& info) { | ||
| RETURN_IF_ERROR(Base::init(state, info)); | ||
| SCOPED_TIMER(exec_time_counter()); | ||
| SCOPED_TIMER(_init_timer); | ||
| _get_results_timer = ADD_TIMER(profile(), "GetResultsTime"); | ||
| _serialize_result_timer = ADD_TIMER(profile(), "SerializeResultTime"); | ||
| _hash_table_iterate_timer = ADD_TIMER(profile(), "HashTableIterateTime"); | ||
| _insert_keys_to_column_timer = ADD_TIMER(profile(), "InsertKeysToColumnTime"); | ||
| _serialize_data_timer = ADD_TIMER(profile(), "SerializeDataTime"); | ||
| _insert_values_to_column_timer = ADD_TIMER(profile(), "InsertValuesToColumnTime"); | ||
|
|
||
| _merge_timer = ADD_TIMER(Base::profile(), "MergeTime"); | ||
| _deserialize_data_timer = ADD_TIMER(Base::profile(), "DeserializeAndMergeTime"); | ||
|
|
@@ -58,7 +56,7 @@ Status AggLocalState::init(RuntimeState* state, LocalStateInfo& info) { | |
| std::placeholders::_1, std::placeholders::_2, | ||
| std::placeholders::_3); | ||
| } else { | ||
| _executor.get_result = std::bind<Status>(&AggLocalState::_serialize_without_key, this, | ||
| _executor.get_result = std::bind<Status>(&AggLocalState::_get_results_without_key, this, | ||
| std::placeholders::_1, std::placeholders::_2, | ||
| std::placeholders::_3); | ||
| } | ||
|
|
@@ -69,8 +67,8 @@ Status AggLocalState::init(RuntimeState* state, LocalStateInfo& info) { | |
| std::placeholders::_2, std::placeholders::_3); | ||
| } else { | ||
| _executor.get_result = std::bind<Status>( | ||
| &AggLocalState::_serialize_with_serialized_key_result, this, | ||
| std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); | ||
| &AggLocalState::_get_results_with_serialized_key, this, std::placeholders::_1, | ||
| std::placeholders::_2, std::placeholders::_3); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -94,18 +92,9 @@ Status AggLocalState::_create_agg_status(vectorized::AggregateDataPtr data) { | |
| return Status::OK(); | ||
| } | ||
|
|
||
| Status AggLocalState::_destroy_agg_status(vectorized::AggregateDataPtr data) { | ||
| auto& shared_state = *Base::_shared_state; | ||
| for (int i = 0; i < shared_state.aggregate_evaluators.size(); ++i) { | ||
| shared_state.aggregate_evaluators[i]->function()->destroy( | ||
| data + shared_state.offsets_of_aggregate_states[i]); | ||
| } | ||
| return Status::OK(); | ||
| } | ||
|
|
||
| Status AggLocalState::_serialize_with_serialized_key_result(RuntimeState* state, | ||
| vectorized::Block* block, bool* eos) { | ||
| SCOPED_TIMER(_serialize_result_timer); | ||
| Status AggLocalState::_get_results_with_serialized_key(RuntimeState* state, | ||
|
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: function '_get_results_with_serialized_key' exceeds recommended size/complexity thresholds [readability-function-size] Status AggLocalState::_get_results_with_serialized_key(RuntimeState* state,
^Additional contextbe/src/pipeline/exec/aggregation_source_operator.cpp:94: 115 lines including whitespace and comments (threshold 80) Status AggLocalState::_get_results_with_serialized_key(RuntimeState* state,
^ |
||
| vectorized::Block* block, bool* eos) { | ||
| SCOPED_TIMER(_get_results_timer); | ||
| auto& shared_state = *_shared_state; | ||
| size_t key_size = _shared_state->probe_expr_ctxs.size(); | ||
| size_t agg_size = _shared_state->aggregate_evaluators.size(); | ||
|
|
@@ -125,7 +114,6 @@ Status AggLocalState::_serialize_with_serialized_key_result(RuntimeState* state, | |
| } | ||
| } | ||
|
|
||
| SCOPED_TIMER(_get_results_timer); | ||
| std::visit( | ||
| vectorized::Overload { | ||
| [&](std::monostate& arg) -> void { | ||
|
|
@@ -181,7 +169,7 @@ Status AggLocalState::_serialize_with_serialized_key_result(RuntimeState* state, | |
| } | ||
|
|
||
| { | ||
| SCOPED_TIMER(_serialize_data_timer); | ||
| SCOPED_TIMER(_insert_values_to_column_timer); | ||
| for (size_t i = 0; i < shared_state.aggregate_evaluators.size(); ++i) { | ||
| value_data_types[i] = shared_state.aggregate_evaluators[i] | ||
| ->function() | ||
|
|
@@ -333,13 +321,13 @@ Status AggLocalState::_get_with_serialized_key_result(RuntimeState* state, vecto | |
| return Status::OK(); | ||
| } | ||
|
|
||
| Status AggLocalState::_serialize_without_key(RuntimeState* state, vectorized::Block* block, | ||
| bool* eos) { | ||
| Status AggLocalState::_get_results_without_key(RuntimeState* state, vectorized::Block* block, | ||
| bool* eos) { | ||
| SCOPED_TIMER(_get_results_timer); | ||
| auto& shared_state = *_shared_state; | ||
| // 1. `child(0)->rows_returned() == 0` mean not data from child | ||
| // in level two aggregation node should return NULL result | ||
| // level one aggregation node set `eos = true` return directly | ||
| SCOPED_TIMER(_serialize_result_timer); | ||
| if (UNLIKELY(_shared_state->input_num_rows == 0)) { | ||
| *eos = true; | ||
| return Status::OK(); | ||
|
|
@@ -573,17 +561,6 @@ template Status AggSourceOperatorX::merge_with_serialized_key_helper<true>( | |
| template Status AggSourceOperatorX::merge_with_serialized_key_helper<false>( | ||
| RuntimeState* state, vectorized::Block* block); | ||
|
|
||
| size_t AggLocalState::_get_hash_table_size() { | ||
| return std::visit( | ||
| vectorized::Overload {[&](std::monostate& arg) -> size_t { | ||
| throw doris::Exception(ErrorCode::INTERNAL_ERROR, | ||
| "uninited hash table"); | ||
| return 0; | ||
| }, | ||
| [&](auto& agg_method) { return agg_method.hash_table->size(); }}, | ||
| _shared_state->agg_data->method_variant); | ||
| } | ||
|
|
||
| void AggLocalState::_emplace_into_hash_table(vectorized::AggregateDataPtr* places, | ||
| vectorized::ColumnRawPtrs& key_columns, | ||
| size_t num_rows) { | ||
|
|
||
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
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.