This is an automated email from the ASF dual-hosted git repository.
panjuan 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 275a3a070d2 Refactor LocalDataQueryResultRow (#30109)
275a3a070d2 is described below
commit 275a3a070d21d6c64eb6da48df1c53c0bc65473f
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Feb 13 19:41:45 2024 +0800
Refactor LocalDataQueryResultRow (#30109)
---
.../executor/rql/resource/ShowStorageUnitExecutorTest.java | 4 ++--
.../infra/merge/result/impl/local/LocalDataQueryResultRow.java | 4 ++--
.../distsql/ral/queryable/ShowComputeNodeInfoExecutorTest.java | 4 ++--
.../distsql/ral/queryable/ShowComputeNodesExecutorTest.java | 8 ++++----
.../handler/admin/executor/ShowConnectionIdExecutorTest.java | 4 ++--
5 files changed, 12 insertions(+), 12 deletions(-)
diff --git
a/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rql/resource/ShowStorageUnitExecutorTest.java
b/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rql/resource/ShowStorageUnitExecutorTest.java
index e763d5102e5..3f0f8806687 100644
---
a/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rql/resource/ShowStorageUnitExecutorTest.java
+++
b/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rql/resource/ShowStorageUnitExecutorTest.java
@@ -85,7 +85,7 @@ class ShowStorageUnitExecutorTest {
assertThat(data.getCell(1), is(nameMap.get(index)));
assertThat(data.getCell(2), is("MySQL"));
assertThat(data.getCell(3), is("localhost"));
- assertThat(data.getCell(4), is(3307));
+ assertThat(data.getCell(4), is("3307"));
assertThat(data.getCell(5), is(nameMap.get(index)));
assertThat(data.getCell(6), is(""));
assertThat(data.getCell(7), is(""));
@@ -109,7 +109,7 @@ class ShowStorageUnitExecutorTest {
assertThat(data.getCell(1), is("ds_2"));
assertThat(data.getCell(2), is("MySQL"));
assertThat(data.getCell(3), is("localhost"));
- assertThat(data.getCell(4), is(3307));
+ assertThat(data.getCell(4), is("3307"));
assertThat(data.getCell(5), is("ds_2"));
assertThat(data.getCell(6), is(""));
assertThat(data.getCell(7), is(""));
diff --git
a/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/result/impl/local/LocalDataQueryResultRow.java
b/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/result/impl/local/LocalDataQueryResultRow.java
index d814e7a4158..d23f7bee2c0 100644
---
a/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/result/impl/local/LocalDataQueryResultRow.java
+++
b/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/result/impl/local/LocalDataQueryResultRow.java
@@ -40,8 +40,8 @@ public final class LocalDataQueryResultRow {
if (null == data) {
return "";
}
- if (data instanceof Boolean) {
- return Boolean.toString((Boolean) data);
+ if (data instanceof Boolean || data instanceof Integer || data
instanceof Long || data instanceof Float || data instanceof Double) {
+ return data.toString();
}
if (data instanceof Enum) {
return ((Enum<?>) data).name();
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodeInfoExecutorTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodeInfoExecutorTest.java
index af5b8003d1a..8d6ab46e585 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodeInfoExecutorTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodeInfoExecutorTest.java
@@ -49,10 +49,10 @@ class ShowComputeNodeInfoExecutorTest {
LocalDataQueryResultRow row = actual.iterator().next();
assertThat(row.getCell(1), is("foo"));
assertThat(row.getCell(2), is("127.0.0.1"));
- assertThat(row.getCell(3), is(3309));
+ assertThat(row.getCell(3), is("3309"));
assertThat(row.getCell(4), is("OK"));
assertThat(row.getCell(5), is("Standalone"));
- assertThat(row.getCell(6), is(0));
+ assertThat(row.getCell(6), is("0"));
assertThat(row.getCell(7), is(""));
assertThat(row.getCell(8), is("foo_version"));
}
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodesExecutorTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodesExecutorTest.java
index ecce75e0da7..5efd35cd1e0 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodesExecutorTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodesExecutorTest.java
@@ -53,10 +53,10 @@ class ShowComputeNodesExecutorTest {
assertThat(row.getCell(1), is("foo"));
assertThat(row.getCell(2), is("PROXY"));
assertThat(row.getCell(3), is("127.0.0.1"));
- assertThat(row.getCell(4), is(3308));
+ assertThat(row.getCell(4), is("3308"));
assertThat(row.getCell(5), is("OK"));
assertThat(row.getCell(6), is("Standalone"));
- assertThat(row.getCell(7), is(0));
+ assertThat(row.getCell(7), is("0"));
assertThat(row.getCell(8), is(""));
assertThat(row.getCell(9), is("foo_version"));
}
@@ -73,10 +73,10 @@ class ShowComputeNodesExecutorTest {
assertThat(row.getCell(1), is("foo"));
assertThat(row.getCell(2), is("PROXY"));
assertThat(row.getCell(3), is("127.0.0.1"));
- assertThat(row.getCell(4), is(3309));
+ assertThat(row.getCell(4), is("3309"));
assertThat(row.getCell(5), is("OK"));
assertThat(row.getCell(6), is("Cluster"));
- assertThat(row.getCell(7), is(1));
+ assertThat(row.getCell(7), is("1"));
assertThat(row.getCell(8), is(""));
assertThat(row.getCell(9), is("foo_version"));
}
diff --git
a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowConnectionIdExecutorTest.java
b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowConnectionIdExecutorTest.java
index 110b63e0661..d2b3274e480 100644
---
a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowConnectionIdExecutorTest.java
+++
b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowConnectionIdExecutorTest.java
@@ -47,7 +47,7 @@ class ShowConnectionIdExecutorTest {
assertThat(metaData.getColumnName(1),
is(ShowConnectionIdExecutor.FUNCTION_NAME));
assertThat(metaData.getColumnLabel(1),
is(ShowConnectionIdExecutor.FUNCTION_NAME));
while (executor.getMergedResult().next()) {
- assertThat(executor.getMergedResult().getValue(1, Object.class),
is(109));
+ assertThat(executor.getMergedResult().getValue(1, Object.class),
is("109"));
}
}
@@ -60,7 +60,7 @@ class ShowConnectionIdExecutorTest {
assertThat(metaData.getColumnName(1),
is(ShowConnectionIdExecutor.FUNCTION_NAME));
assertThat(metaData.getColumnLabel(1), is("test_alias"));
while (executor.getMergedResult().next()) {
- assertThat(executor.getMergedResult().getValue(1, Object.class),
is(109));
+ assertThat(executor.getMergedResult().getValue(1, Object.class),
is("109"));
}
}