This is an automated email from the ASF dual-hosted git repository.
englefly 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 7f310cec9c9 [opt](sessionVar)show changed sessoin var first #28840
7f310cec9c9 is described below
commit 7f310cec9c9a4f3ce154211e8d982ad30f8e173e
Author: minghong <[email protected]>
AuthorDate: Fri Dec 22 14:45:33 2023 +0800
[opt](sessionVar)show changed sessoin var first #28840
“show variables” command list changed vars before not changed vars,
---
.../main/java/org/apache/doris/qe/VariableMgr.java | 25 ++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
index 170c86e47ea..7b797ea84a2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
@@ -691,7 +691,8 @@ public class VariableMgr {
// Dump all fields. Used for `show variables`
public static List<List<String>> dump(SetType type, SessionVariable
sessionVar, PatternMatcher matcher) {
- List<List<String>> rows = Lists.newArrayList();
+ List<List<String>> changedRows = Lists.newArrayList();
+ List<List<String>> defaultRows = Lists.newArrayList();
// Hold the read lock when session dump, because this option need to
access global variable.
rlock.lock();
try {
@@ -732,23 +733,35 @@ public class VariableMgr {
} else {
row.add(varContext.defaultValue);
}
- row.add(row.get(1).equals(row.get(2)) ? "0" : "1");
-
- rows.add(row);
+ if (row.get(1).equals(row.get(2))) {
+ row.add("0");
+ defaultRows.add(row);
+ } else {
+ row.add("1");
+ changedRows.add(row);
+ }
}
} finally {
rlock.unlock();
}
// Sort all variables by variable name.
- Collections.sort(rows, new Comparator<List<String>>() {
+ Collections.sort(changedRows, new Comparator<List<String>>() {
+ @Override
+ public int compare(List<String> o1, List<String> o2) {
+ return o1.get(0).compareTo(o2.get(0));
+ }
+ });
+
+ Collections.sort(defaultRows, new Comparator<List<String>>() {
@Override
public int compare(List<String> o1, List<String> o2) {
return o1.get(0).compareTo(o2.get(0));
}
});
- return rows;
+ changedRows.addAll(defaultRows);
+ return changedRows;
}
@Retention(RetentionPolicy.RUNTIME)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]