Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,8 @@ public static String getDefaultValue(String key) {

// 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 {
Expand Down Expand Up @@ -732,23 +733,35 @@ public static List<List<String>> dump(SetType type, SessionVariable sessionVar,
} 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)
Expand Down