This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new e32406c40b0 [chore](profile) Add checker for profile level (#48787)
e32406c40b0 is described below
commit e32406c40b06d01aebb5e80b856d2e1c22f79330
Author: zhiqiang <[email protected]>
AuthorDate: Tue Mar 11 23:59:28 2025 +0800
[chore](profile) Add checker for profile level (#48787)
---
.../java/org/apache/doris/qe/SessionVariable.java | 24 +++++++++++-
.../suites/query_profile/profile_level.groovy | 43 ++++++++++++++++++++++
2 files changed, 66 insertions(+), 1 deletion(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
index 51ed62816b0..1a502151278 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
@@ -1038,7 +1038,8 @@ public class SessionVariable implements Serializable,
Writable {
"Use consistent hashing to split the appearance for
external scan"})
public boolean useConsistentHashForExternalScan = false;
- @VariableMgr.VarAttr(name = PROFILE_LEVEL, fuzzy = true,
+ @VariableMgr.VarAttr(name = PROFILE_LEVEL, fuzzy = false,
+ setter = "setProfileLevel", checker = "checkProfileLevel",
description = { "查询profile的级别,1表示只收集 MergedProfile 级别的 Counter,2
表示打印详细信息,"
+ "3 表示打开一些可能导致性能回退的 Counter", "The level of query
profile, "
+ "1 means only collect Counter of MergedProfile,
2 means print detailed information,"
@@ -4705,6 +4706,27 @@ public class SessionVariable implements Serializable,
Writable {
return disableInvertedIndexV1ForVaraint;
}
+ public void setProfileLevel(String profileLevel) {
+ int profileLevelTmp = Integer.valueOf(profileLevel);
+ if (profileLevelTmp < 1 || profileLevelTmp > 3) {
+ LOG.warn("Profile level shuold be in the range of 1-3.");
+ } else {
+ this.profileLevel = profileLevelTmp;
+ }
+
+ }
+
+ public void checkProfileLevel(String profileLevel) {
+ int value = Integer.valueOf(profileLevel);
+ if (value < 1 || value > 3) {
+ UnsupportedOperationException exception =
+ new UnsupportedOperationException("Profile level can not
be set to " + profileLevel
+ + ", it must be in the range of 1-3");
+ LOG.warn("Check profile_level failed", exception);
+ throw exception;
+ }
+ }
+
public boolean getEnableLocalMergeSort() {
return enableLocalMergeSort;
}
diff --git a/regression-test/suites/query_profile/profile_level.groovy
b/regression-test/suites/query_profile/profile_level.groovy
new file mode 100644
index 00000000000..5d65c461c4c
--- /dev/null
+++ b/regression-test/suites/query_profile/profile_level.groovy
@@ -0,0 +1,43 @@
+// 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.
+
+import org.junit.Assert
+
+suite('set_profile_level') {
+ boolean exception = false
+ try {
+ sql("set profile_level = 0;")
+ } catch (Exception e) {
+ exception = true
+ }
+ Assert.assertEquals(exception, true)
+ exception = false
+
+ try {
+ sql("set profile_level = 1;")
+ } catch (Exception e) {
+ exception = true
+ }
+ Assert.assertEquals(exception, false)
+
+ try {
+ sql("set profile_level = 4;")
+ } catch (Exception e) {
+ exception = true
+ }
+ Assert.assertEquals(exception, true)
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]