This is an automated email from the ASF dual-hosted git repository.

jianglongtao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 41bb581f80d Modify the sort of SHOW DIST VARIABLES alphabetically 
(#25151)
41bb581f80d is described below

commit 41bb581f80d29c82b641f0d4965a45d8f553f93f
Author: ChenJiaHao <[email protected]>
AuthorDate: Thu Apr 13 18:21:05 2023 +0800

    Modify the sort of SHOW DIST VARIABLES alphabetically (#25151)
    
    * Modify the sort of SHOW DIST VARIABLES alphabetically
    
    * Update UT
---
 .../ral/queryable/ShowDistVariablesExecutor.java   |  3 ++-
 .../queryable/ShowDistVariablesExecutorTest.java   |  4 ++--
 .../dataset/empty_rules/show_dist_variables.xml    | 28 +++++++++++-----------
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java
index 1c4889c18e2..1ab0e4aa9b2 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java
@@ -32,6 +32,7 @@ import 
org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtils;
 
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Comparator;
 import java.util.Optional;
 import java.util.Properties;
 import java.util.stream.Collectors;
@@ -58,7 +59,7 @@ public final class ShowDistVariablesExecutor implements 
ConnectionSessionRequire
         result.add(new 
LocalDataQueryResultRow(VariableEnum.CACHED_CONNECTIONS.name().toLowerCase(), 
connectionSession.getBackendConnection().getConnectionSize()));
         result.add(new 
LocalDataQueryResultRow(VariableEnum.TRANSACTION_TYPE.name().toLowerCase(), 
connectionSession.getTransactionStatus().getTransactionType().name()));
         addLoggingPropsRows(metaData, result);
-        return result;
+        return result.stream().sorted(Comparator.comparing(each -> 
each.getCell(1).toString())).collect(Collectors.toList());
     }
     
     private void addLoggingPropsRows(final ShardingSphereMetaData metaData, 
final Collection<LocalDataQueryResultRow> result) {
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutorTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutorTest.java
index 5ec6b56d32c..f9306179863 100644
--- 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutorTest.java
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutorTest.java
@@ -66,7 +66,7 @@ class ShowDistVariablesExecutorTest {
         Collection<LocalDataQueryResultRow> actual = 
executor.getRows(metaData, connectionSession, 
mock(ShowDistVariablesStatement.class));
         assertThat(actual.size(), is(23));
         LocalDataQueryResultRow row = actual.iterator().next();
-        assertThat(row.getCell(1), is("system_log_level"));
-        assertThat(row.getCell(2), is("INFO"));
+        assertThat(row.getCell(1), is("agent_plugins_enabled"));
+        assertThat(row.getCell(2), is("true"));
     }
 }
diff --git 
a/test/e2e/sql/src/test/resources/cases/ral/dataset/empty_rules/show_dist_variables.xml
 
b/test/e2e/sql/src/test/resources/cases/ral/dataset/empty_rules/show_dist_variables.xml
index f60335ff415..5da71f86cbc 100644
--- 
a/test/e2e/sql/src/test/resources/cases/ral/dataset/empty_rules/show_dist_variables.xml
+++ 
b/test/e2e/sql/src/test/resources/cases/ral/dataset/empty_rules/show_dist_variables.xml
@@ -20,27 +20,27 @@
         <column name="variable_name" />
         <column name="variable_value" />
     </metadata>
-    <row values="system_log_level| INFO" />
+    <row values="agent_plugins_enabled| true" />
+    <row values="cached_connections| 0" />
+    <row values="cdc_server_port| 33071" />
+    <row values="check_table_meta_data_enabled| false" />
     <row values="kernel_executor_size| 16" />
     <row values="max_connections_size_per_query| 1" />
-    <row values="check_table_meta_data_enabled| false" />
-    <row values="sql_federation_type| ADVANCED" />
-    <row values="proxy_frontend_database_protocol_type| " />
-    <row values="proxy_frontend_flush_threshold| 128" />
-    <row values="proxy_hint_enabled| true" />
+    <row values="proxy_backend_executor_suitable| OLAP" />
     <row values="proxy_backend_query_fetch_size| -1" />
+    <row values="proxy_default_port| 3307" />
+    <row values="proxy_frontend_database_protocol_type| " />
     <row values="proxy_frontend_executor_size| 0" />
-    <row values="proxy_backend_executor_suitable| OLAP" />
+    <row values="proxy_frontend_flush_threshold| 128" />
     <row values="proxy_frontend_max_connections| 0" />
-    <row values="proxy_mysql_default_version| 5.7.22" />
-    <row values="proxy_default_port| 3307" />
-    <row values="proxy_netty_backlog| 1024" />
+    <row values="proxy_hint_enabled| true" />
     <row values="proxy_instance_type| Proxy" />
-    <row values="cdc_server_port| 33071" />
     <row values="proxy_meta_data_collector_enabled| true" />
-    <row values="agent_plugins_enabled| true" />
-    <row values="cached_connections| 0" />
-    <row values="transaction_type| LOCAL" />
+    <row values="proxy_mysql_default_version| 5.7.22" />
+    <row values="proxy_netty_backlog| 1024" />
+    <row values="sql_federation_type| ADVANCED" />
     <row values="sql_show| false" />
     <row values="sql_simple| false" />
+    <row values="system_log_level| INFO" />
+    <row values="transaction_type| LOCAL" />
 </dataset>

Reply via email to