-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature](profilev2) Preliminary support for profilev2. (#24881)
You can set the level of counters on the backend using ADD_COUNTER_WITH_LEVEL/ADD_TIMER_WITH_LEVEL. The profile can then merge counters with level 1. set profile_level = 1; such as sql select count(*) from customer join item on c_customer_sk = i_item_sk profile Simple profile PLAN FRAGMENT 0 OUTPUT EXPRS: count(*) PARTITION: UNPARTITIONED VRESULT SINK MYSQL_PROTOCAL 7:VAGGREGATE (merge finalize) | output: count(partial_count(*))[#44] | group by: | cardinality=1 | TotalTime: avg 725.608us, max 725.608us, min 725.608us | RowsReturned: 1 | 6:VEXCHANGE offset: 0 TotalTime: avg 52.411us, max 52.411us, min 52.411us RowsReturned: 8 PLAN FRAGMENT 1 PARTITION: HASH_PARTITIONED: c_customer_sk STREAM DATA SINK EXCHANGE ID: 06 UNPARTITIONED TotalTime: avg 106.263us, max 118.38us, min 81.403us BlocksSent: 8 5:VAGGREGATE (update serialize) | output: partial_count(*)[#43] | group by: | cardinality=1 | TotalTime: avg 679.296us, max 739.395us, min 554.904us | BuildTime: avg 33.198us, max 48.387us, min 28.880us | ExecTime: avg 27.633us, max 40.278us, min 24.537us | RowsReturned: 8 | 4:VHASH JOIN | join op: INNER JOIN(PARTITIONED)[] | equal join conjunct: c_customer_sk = i_item_sk | runtime filters: RF000[bloom] <- i_item_sk(18000/16384/1048576) | cardinality=17,740 | vec output tuple id: 3 | vIntermediate tuple ids: 2 | hash output slot ids: 22 | RowsReturned: 18.0K (18000) | ProbeRows: 18.0K (18000) | ProbeTime: avg 862.308us, max 1.576ms, min 666.28us | BuildRows: 18.0K (18000) | BuildTime: avg 3.8ms, max 3.860ms, min 2.317ms | |----1:VEXCHANGE | offset: 0 | TotalTime: avg 48.822us, max 67.459us, min 30.380us | RowsReturned: 18.0K (18000) | 3:VEXCHANGE offset: 0 TotalTime: avg 33.162us, max 39.480us, min 28.854us RowsReturned: 18.0K (18000) PLAN FRAGMENT 2 PARTITION: HASH_PARTITIONED: c_customer_id STREAM DATA SINK EXCHANGE ID: 03 HASH_PARTITIONED: c_customer_sk TotalTime: avg 753.954us, max 1.210ms, min 499.470us BlocksSent: 64 2:VOlapScanNode TABLE: default_cluster:tpcds.customer(customer), PREAGGREGATION: ON runtime filters: RF000[bloom] -> c_customer_sk partitions=1/1, tablets=12/12, tabletList=1550745,1550747,1550749 ... cardinality=100000, avgRowSize=0.0, numNodes=1 pushAggOp=NONE TotalTime: avg 18.417us, max 41.319us, min 10.189us RowsReturned: 18.0K (18000) --------- Co-authored-by: yiguolei <[email protected]>
- Loading branch information
Showing
20 changed files
with
375 additions
and
140 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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
99 changes: 99 additions & 0 deletions
99
fe/fe-core/src/main/java/org/apache/doris/common/util/ProfileStatistics.java
This file contains 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,99 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package org.apache.doris.common.util; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
|
||
/** | ||
* Used for collecting information obtained from the profile. | ||
*/ | ||
public class ProfileStatistics { | ||
// Record statistical information based on nodeid. | ||
private HashMap<Integer, ArrayList<String>> statisticalInfo; | ||
|
||
// Record statistical information based on fragment ID. | ||
// "Currently used to record sink nodes. | ||
private HashMap<Integer, ArrayList<String>> fragmentInfo; | ||
|
||
private int fragmentId; | ||
|
||
private boolean isDataSink; | ||
|
||
public ProfileStatistics() { | ||
statisticalInfo = new HashMap<Integer, ArrayList<String>>(); | ||
fragmentInfo = new HashMap<Integer, ArrayList<String>>(); | ||
fragmentId = 0; | ||
isDataSink = false; | ||
} | ||
|
||
private void addPlanNodeInfo(int id, String info) { | ||
if (!statisticalInfo.containsKey(id)) { | ||
statisticalInfo.put(id, new ArrayList<String>()); | ||
} | ||
statisticalInfo.get(id).add(info); | ||
} | ||
|
||
private void addDataSinkInfo(String info) { | ||
if (fragmentInfo.get(fragmentId) == null) { | ||
fragmentInfo.put(fragmentId, new ArrayList<String>()); | ||
} | ||
fragmentInfo.get(fragmentId).add(info); | ||
} | ||
|
||
public void addInfoFromProfile(RuntimeProfile profile, String info) { | ||
if (isDataSink) { | ||
addDataSinkInfo(info); | ||
} else { | ||
addPlanNodeInfo(profile.nodeId(), info); | ||
} | ||
} | ||
|
||
public boolean hasInfo(int id) { | ||
return statisticalInfo.containsKey(id); | ||
} | ||
|
||
public void getInfoById(int id, String prefix, StringBuilder str) { | ||
if (!hasInfo(id)) { | ||
return; | ||
} | ||
ArrayList<String> infos = statisticalInfo.get(id); | ||
for (String info : infos) { | ||
str.append(prefix + info + "\n"); | ||
} | ||
} | ||
|
||
public void getDataSinkInfo(int fragmentIdx, String prefix, StringBuilder str) { | ||
if (!fragmentInfo.containsKey(fragmentIdx)) { | ||
return; | ||
} | ||
ArrayList<String> infos = fragmentInfo.get(fragmentIdx); | ||
for (String info : infos) { | ||
str.append(prefix + info + "\n"); | ||
} | ||
} | ||
|
||
public void setFragmentId(int id) { | ||
this.fragmentId = id; | ||
} | ||
|
||
public void setIsDataSink(boolean dataSink) { | ||
this.isDataSink = dataSink; | ||
} | ||
|
||
} |
Oops, something went wrong.