This is an automated email from the ASF dual-hosted git repository.
wuweijie 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 9e22577e51f Merge 2 constructors became 1 on LocalDataQueryResultRow
(#30095)
9e22577e51f is described below
commit 9e22577e51f56f183f2b4c6b65869749448e73d5
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Feb 12 00:36:54 2024 +0800
Merge 2 constructors became 1 on LocalDataQueryResultRow (#30095)
---
.../encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java | 4 ++--
.../mask/distsql/handler/query/ShowMaskRuleExecutor.java | 3 +--
.../shadow/distsql/handler/query/ShowShadowRuleExecutor.java | 4 ++--
.../infra/merge/result/impl/local/LocalDataQueryResultRow.java | 2 --
.../merge/result/impl/local/LocalDataMergedResultTest.java | 10 +++-------
.../handler/query/ShowMigrationSourceStorageUnitsExecutor.java | 3 +--
.../admin/executor/MySQLSystemVariableQueryExecutor.java | 2 +-
7 files changed, 10 insertions(+), 18 deletions(-)
diff --git
a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java
b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java
index 2be2e6b161c..c30eaa6cc59 100644
---
a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java
+++
b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java
@@ -68,7 +68,7 @@ public final class ShowEncryptRuleExecutor implements
DistSQLQueryExecutor<ShowE
AlgorithmConfiguration encryptorAlgorithmConfig =
encryptors.get(each.getCipher().getEncryptorName());
AlgorithmConfiguration assistedQueryEncryptorAlgorithmConfig =
each.getAssistedQuery().isPresent() ?
encryptors.get(each.getAssistedQuery().get().getEncryptorName()) : null;
AlgorithmConfiguration likeQueryEncryptorAlgorithmConfig =
each.getLikeQuery().isPresent() ?
encryptors.get(each.getLikeQuery().get().getEncryptorName()) : null;
- result.add(new LocalDataQueryResultRow(Arrays.asList(
+ result.add(new LocalDataQueryResultRow(
tableRuleConfig.getName(),
each.getName(),
each.getCipher().getName(),
@@ -79,7 +79,7 @@ public final class ShowEncryptRuleExecutor implements
DistSQLQueryExecutor<ShowE
null == assistedQueryEncryptorAlgorithmConfig ? "" :
assistedQueryEncryptorAlgorithmConfig.getType(),
null == assistedQueryEncryptorAlgorithmConfig ? "" :
PropertiesConverter.convert(assistedQueryEncryptorAlgorithmConfig.getProps()),
null == likeQueryEncryptorAlgorithmConfig ? "" :
likeQueryEncryptorAlgorithmConfig.getType(),
- null == likeQueryEncryptorAlgorithmConfig ? "" :
PropertiesConverter.convert(likeQueryEncryptorAlgorithmConfig.getProps()))));
+ null == likeQueryEncryptorAlgorithmConfig ? "" :
PropertiesConverter.convert(likeQueryEncryptorAlgorithmConfig.getProps())));
}
return result;
}
diff --git
a/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskRuleExecutor.java
b/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskRuleExecutor.java
index 4d67ed9d6d2..1ffa348e450 100644
---
a/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskRuleExecutor.java
+++
b/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskRuleExecutor.java
@@ -57,8 +57,7 @@ public final class ShowMaskRuleExecutor implements
DistSQLQueryExecutor<ShowMask
Collection<LocalDataQueryResultRow> result = new LinkedList<>();
tableRuleConfig.getColumns().forEach(each -> {
AlgorithmConfiguration maskAlgorithmConfig =
algorithmMap.get(each.getMaskAlgorithm());
- result.add(new LocalDataQueryResultRow(
- Arrays.asList(tableRuleConfig.getName(),
each.getLogicColumn(), maskAlgorithmConfig.getType(),
PropertiesConverter.convert(maskAlgorithmConfig.getProps()))));
+ result.add(new LocalDataQueryResultRow(tableRuleConfig.getName(),
each.getLogicColumn(), maskAlgorithmConfig.getType(),
PropertiesConverter.convert(maskAlgorithmConfig.getProps())));
});
return result;
}
diff --git
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowRuleExecutor.java
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowRuleExecutor.java
index 74cfce2f324..950f4d008e1 100644
---
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowRuleExecutor.java
+++
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowRuleExecutor.java
@@ -77,8 +77,8 @@ public final class ShowShadowRuleExecutor implements
DistSQLQueryExecutor<ShowSh
Collection<LocalDataQueryResultRow> result = new LinkedList<>();
dataSourceTable.forEach((key, value) ->
value.getShadowAlgorithmNames().forEach(each -> {
AlgorithmConfiguration algorithmConfig =
algorithmConfigs.get(each);
- result.add(new LocalDataQueryResultRow(Arrays.asList(key,
dataSourceConfig.getName(), dataSourceConfig.getProductionDataSourceName(),
dataSourceConfig.getShadowDataSourceName(),
- algorithmConfig.getType(),
PropertiesConverter.convert(algorithmConfig.getProps()))));
+ result.add(new LocalDataQueryResultRow(key,
dataSourceConfig.getName(), dataSourceConfig.getProductionDataSourceName(),
dataSourceConfig.getShadowDataSourceName(),
+ algorithmConfig.getType(),
PropertiesConverter.convert(algorithmConfig.getProps())));
}));
return result;
}
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 b2a71fe1772..54ce37db7f0 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
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.infra.merge.result.impl.local;
import com.google.common.base.Preconditions;
-import lombok.RequiredArgsConstructor;
import java.util.Arrays;
import java.util.List;
@@ -26,7 +25,6 @@ import java.util.List;
/**
* Local data query result row.
*/
-@RequiredArgsConstructor
public final class LocalDataQueryResultRow {
private final List<Object> data;
diff --git
a/infra/merge/src/test/java/org/apache/shardingsphere/infra/merge/result/impl/local/LocalDataMergedResultTest.java
b/infra/merge/src/test/java/org/apache/shardingsphere/infra/merge/result/impl/local/LocalDataMergedResultTest.java
index 1f50709a14d..ceeb69eff61 100644
---
a/infra/merge/src/test/java/org/apache/shardingsphere/infra/merge/result/impl/local/LocalDataMergedResultTest.java
+++
b/infra/merge/src/test/java/org/apache/shardingsphere/infra/merge/result/impl/local/LocalDataMergedResultTest.java
@@ -23,7 +23,6 @@ import java.sql.SQLFeatureNotSupportedException;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
-import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -59,22 +58,19 @@ class LocalDataMergedResultTest {
@Test
void assertGetInputStream() {
- List<Object> row = Collections.singletonList("value");
- LocalDataMergedResult actual = new
LocalDataMergedResult(Collections.singletonList(new
LocalDataQueryResultRow(row)));
+ LocalDataMergedResult actual = new
LocalDataMergedResult(Collections.singletonList(new
LocalDataQueryResultRow("value")));
assertThrows(SQLFeatureNotSupportedException.class, () ->
actual.getInputStream(1, "Ascii"));
}
@Test
void assertGetCharacterStream() {
- List<Object> row = Collections.singletonList("value");
- LocalDataMergedResult actual = new
LocalDataMergedResult(Collections.singletonList(new
LocalDataQueryResultRow(row)));
+ LocalDataMergedResult actual = new
LocalDataMergedResult(Collections.singletonList(new
LocalDataQueryResultRow("value")));
assertThrows(SQLFeatureNotSupportedException.class, () ->
actual.getCharacterStream(1));
}
@Test
void assertWasNull() {
- List<Object> row = Collections.singletonList("value");
- LocalDataMergedResult actual = new
LocalDataMergedResult(Collections.singletonList(new
LocalDataQueryResultRow(row)));
+ LocalDataMergedResult actual = new
LocalDataMergedResult(Collections.singletonList(new
LocalDataQueryResultRow("value")));
assertTrue(actual.next());
assertFalse(actual.wasNull());
}
diff --git
a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationSourceStorageUnitsExecutor.java
b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationSourceStorageUnitsExecutor.java
index 7c4b4ae8188..feebc4abc97 100644
---
a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationSourceStorageUnitsExecutor.java
+++
b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationSourceStorageUnitsExecutor.java
@@ -31,7 +31,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
-import java.util.List;
/**
* Show migration source storage units executor.
@@ -51,7 +50,7 @@ public final class ShowMigrationSourceStorageUnitsExecutor
implements DistSQLQue
Iterator<Collection<Object>> data =
jobAPI.listMigrationSourceResources(new
PipelineContextKey(InstanceType.PROXY)).iterator();
Collection<LocalDataQueryResultRow> result = new LinkedList<>();
while (data.hasNext()) {
- result.add(new LocalDataQueryResultRow((List<Object>)
data.next()));
+ result.add(new LocalDataQueryResultRow(data.next().toArray()));
}
return result;
}
diff --git
a/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/MySQLSystemVariableQueryExecutor.java
b/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/MySQLSystemVariableQueryExecutor.java
index 16cf5e1c92c..57301b4f09c 100644
---
a/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/MySQLSystemVariableQueryExecutor.java
+++
b/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/MySQLSystemVariableQueryExecutor.java
@@ -72,7 +72,7 @@ public final class MySQLSystemVariableQueryExecutor
implements DatabaseAdminQuer
metaData.add(new RawQueryResultColumnMetaData("", name, name,
Types.VARCHAR, "VARCHAR", 1024, 0));
}
queryResultMetaData = new RawQueryResultMetaData(metaData);
- mergedResult = new LocalDataMergedResult(Collections.singleton(new
LocalDataQueryResultRow(columnsOfRow)));
+ mergedResult = new LocalDataMergedResult(Collections.singleton(new
LocalDataQueryResultRow(columnsOfRow.toArray())));
}
/**