You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2024/12/08 12:09:24 UTC
(shardingsphere) branch master updated: Refactor InsertClauseShardingConditionEngine (#33965)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 18162e7a6c2 Refactor InsertClauseShardingConditionEngine (#33965)
18162e7a6c2 is described below
commit 18162e7a6c227335deb5cd07c8b8f8b6c91fc8e6
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sun Dec 8 20:09:16 2024 +0800
Refactor InsertClauseShardingConditionEngine (#33965)
* Refactor InsertClauseShardingConditionEngine
* Refactor InsertClauseShardingConditionEngine
* Refactor InsertClauseShardingConditionEngine
* Add test cases
* Add test cases
* Add test cases
---
.../InsertClauseShardingConditionEngine.java | 12 ++--
.../InsertClauseShardingConditionEngineTest.java | 24 +++----
.../database/schema/model/ShardingSphereTable.java | 17 +++++
.../schema/model/ShardingSphereTableTest.java | 73 +++++++++++++---------
.../describe/PostgreSQLComDescribeExecutor.java | 3 +-
5 files changed, 79 insertions(+), 50 deletions(-)
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/InsertClauseShardingConditionEngine.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/InsertClauseShardingConditionEngine.java
index 6abf288651d..15c7cd56153 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/InsertClauseShardingConditionEngine.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/InsertClauseShardingConditionEngine.java
@@ -96,18 +96,14 @@ public final class InsertClauseShardingConditionEngine {
String tableName = sqlStatementContext.getSqlStatement().getTable().map(optional -> optional.getTableName().getIdentifier().getValue())
.orElseGet(() -> sqlStatementContext.getTablesContext().getTableNames().iterator().next());
ShardingSpherePreconditions.checkState(schema.containsTable(tableName), () -> new NoSuchTableException(tableName));
- Collection<String> allColumnNames = schema.getAllColumnNames(tableName);
- if (columnNames.size() == allColumnNames.size()) {
- return;
- }
- for (String each : allColumnNames) {
- if (!columnNames.contains(each.toLowerCase()) && !rule.isGenerateKeyColumn(each, tableName) && rule.findShardingColumn(each, tableName).isPresent()) {
- appendMissingShardingConditions(shardingConditions, each, tableName);
+ for (String each : schema.getTable(tableName).findColumnNamesIfNotExistedFrom(columnNames)) {
+ if (!rule.isGenerateKeyColumn(each, tableName) && rule.findShardingColumn(each, tableName).isPresent()) {
+ appendMissingShardingConditions(tableName, each, shardingConditions);
}
}
}
- private void appendMissingShardingConditions(final List<ShardingCondition> shardingConditions, final String columnName, final String tableName) {
+ private void appendMissingShardingConditions(final String tableName, final String columnName, final List<ShardingCondition> shardingConditions) {
for (ShardingCondition each : shardingConditions) {
each.getValues().add(new ListShardingConditionValue<>(columnName, tableName, Collections.singletonList(null)));
}
diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/InsertClauseShardingConditionEngineTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/InsertClauseShardingConditionEngineTest.java
index fb25b3d09f3..8de28bf9eed 100644
--- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/InsertClauseShardingConditionEngineTest.java
+++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/InsertClauseShardingConditionEngineTest.java
@@ -49,6 +49,7 @@ import org.mockito.quality.Strictness;
import java.util.Arrays;
import java.util.Collections;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Optional;
import java.util.Properties;
@@ -70,7 +71,7 @@ class InsertClauseShardingConditionEngineTest {
private InsertClauseShardingConditionEngine shardingConditionEngine;
@Mock
- private ShardingRule shardingRule;
+ private ShardingRule rule;
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private InsertStatementContext insertStatementContext;
@@ -79,7 +80,7 @@ class InsertClauseShardingConditionEngineTest {
void setUp() {
ShardingSphereDatabase database = mockDatabase();
InsertStatement insertStatement = mockInsertStatement();
- shardingConditionEngine = new InsertClauseShardingConditionEngine(database, shardingRule, new TimestampServiceRule(new TimestampServiceRuleConfiguration("System", new Properties())));
+ shardingConditionEngine = new InsertClauseShardingConditionEngine(database, rule, new TimestampServiceRule(new TimestampServiceRuleConfiguration("System", new Properties())));
when(insertStatementContext.getSqlStatement()).thenReturn(insertStatement);
when(insertStatementContext.getColumnNames()).thenReturn(Arrays.asList("foo_col_1", "foo_col_3"));
when(insertStatementContext.getInsertValueContexts()).thenReturn(Collections.singletonList(createInsertValueContext()));
@@ -88,12 +89,13 @@ class InsertClauseShardingConditionEngineTest {
when(insertStatementContext.getTablesContext().getSchemaName()).thenReturn(Optional.empty());
}
- private static ShardingSphereDatabase mockDatabase() {
+ private ShardingSphereDatabase mockDatabase() {
ShardingSphereDatabase result = mock(ShardingSphereDatabase.class);
when(result.getName()).thenReturn("foo_db");
ShardingSphereSchema schema = mock(ShardingSphereSchema.class, RETURNS_DEEP_STUBS);
when(schema.containsTable("foo_tbl")).thenReturn(true);
when(schema.getTable("foo_tbl").getColumnNames()).thenReturn(Arrays.asList("foo_col_1", "foo_col_2", "foo_Col_3"));
+ when(schema.getTable("foo_tbl").findColumnNamesIfNotExistedFrom(new LinkedHashSet<>(Arrays.asList("foo_col_1", "foo_col_3")))).thenReturn(Collections.singleton("foo_col_2"));
when(result.getSchema("foo_db")).thenReturn(schema);
return result;
}
@@ -128,7 +130,7 @@ class InsertClauseShardingConditionEngineTest {
void assertCreateShardingConditionsInsertStatementWithGeneratedKeyContextUsingCommonExpressionSegmentEmpty() {
when(insertStatementContext.getInsertValueContexts()).thenReturn(Collections.singletonList(createInsertValueContextAsCommonExpressionSegmentEmptyText()));
when(insertStatementContext.getGeneratedKeyContext()).thenReturn(Optional.of(mock(GeneratedKeyContext.class)));
- when(shardingRule.findShardingColumn("foo_col_1", "foo_tbl")).thenReturn(Optional.of("foo_col_1"));
+ when(rule.findShardingColumn("foo_col_1", "foo_tbl")).thenReturn(Optional.of("foo_col_1"));
List<ShardingCondition> shardingConditions = shardingConditionEngine.createShardingConditions(insertStatementContext, Collections.emptyList());
assertThat(shardingConditions.get(0).getStartIndex(), is(0));
assertThat(shardingConditions.get(0).getValues().size(), is(1));
@@ -138,7 +140,7 @@ class InsertClauseShardingConditionEngineTest {
void assertCreateShardingConditionsInsertStatementWithMismatchColumns() {
InsertValueContext insertValueContext = new InsertValueContext(Arrays.asList(new LiteralExpressionSegment(0, 10, "1"), new LiteralExpressionSegment(0, 10, "1")), Collections.emptyList(), 0);
when(insertStatementContext.getInsertValueContexts()).thenReturn(Collections.singletonList(insertValueContext));
- when(shardingRule.findShardingColumn("foo_col_1", "foo_tbl")).thenReturn(Optional.of("foo_col_1"));
+ when(rule.findShardingColumn("foo_col_1", "foo_tbl")).thenReturn(Optional.of("foo_col_1"));
when(insertStatementContext.getColumnNames()).thenReturn(Collections.singletonList("foo_col_1"));
assertThrows(InsertColumnsAndValuesMismatchedException.class, () -> shardingConditionEngine.createShardingConditions(insertStatementContext, Collections.emptyList()));
}
@@ -147,7 +149,7 @@ class InsertClauseShardingConditionEngineTest {
void assertCreateShardingConditionsInsertStatementWithGeneratedKeyContextUsingCommonExpressionSegmentNow() {
when(insertStatementContext.getInsertValueContexts()).thenReturn(Collections.singletonList(createInsertValueContextAsCommonExpressionSegmentWithNow()));
when(insertStatementContext.getGeneratedKeyContext()).thenReturn(Optional.of(mock(GeneratedKeyContext.class)));
- when(shardingRule.findShardingColumn("foo_col_1", "foo_tbl")).thenReturn(Optional.of("foo_col_1"));
+ when(rule.findShardingColumn("foo_col_1", "foo_tbl")).thenReturn(Optional.of("foo_col_1"));
List<ShardingCondition> shardingConditions = shardingConditionEngine.createShardingConditions(insertStatementContext, Collections.emptyList());
assertThat(shardingConditions.get(0).getStartIndex(), is(0));
assertFalse(shardingConditions.get(0).getValues().isEmpty());
@@ -167,8 +169,8 @@ class InsertClauseShardingConditionEngineTest {
when(insertStatementContext.getGeneratedKeyContext()).thenReturn(Optional.of(generatedKeyContext));
when(generatedKeyContext.isGenerated()).thenReturn(true);
when(generatedKeyContext.getGeneratedValues()).thenReturn(Collections.singleton("foo_col_1"));
- when(shardingRule.findShardingTable("foo_tbl")).thenReturn(Optional.of(new ShardingTable(Collections.singleton("foo_col_1"), "test")));
- when(shardingRule.findShardingColumn(any(), any())).thenReturn(Optional.of("foo_sharding_col"));
+ when(rule.findShardingTable("foo_tbl")).thenReturn(Optional.of(new ShardingTable(Collections.singleton("foo_col_1"), "test")));
+ when(rule.findShardingColumn(any(), any())).thenReturn(Optional.of("foo_sharding_col"));
List<ShardingCondition> shardingConditions = shardingConditionEngine.createShardingConditions(insertStatementContext, Collections.emptyList());
assertThat(shardingConditions.get(0).getStartIndex(), is(0));
assertFalse(shardingConditions.get(0).getValues().isEmpty());
@@ -178,7 +180,7 @@ class InsertClauseShardingConditionEngineTest {
void assertCreateShardingConditionsWithParameterMarkers() {
InsertValueContext insertValueContext = new InsertValueContext(Collections.singleton(new ParameterMarkerExpressionSegment(0, 0, 0)), Collections.singletonList(1), 0);
when(insertStatementContext.getInsertValueContexts()).thenReturn(Collections.singletonList(insertValueContext));
- when(shardingRule.findShardingColumn("foo_col_1", "foo_tbl")).thenReturn(Optional.of("foo_col_1"));
+ when(rule.findShardingColumn("foo_col_1", "foo_tbl")).thenReturn(Optional.of("foo_col_1"));
List<ShardingCondition> shardingConditions = shardingConditionEngine.createShardingConditions(insertStatementContext, Collections.singletonList(1));
assertThat(shardingConditions.size(), is(1));
assertThat(shardingConditions.get(0).getValues().size(), is(1));
@@ -201,7 +203,7 @@ class InsertClauseShardingConditionEngineTest {
@Test
void assertCreateShardingConditionsWithoutShardingColumn() {
- when(shardingRule.findShardingColumn("foo_col_2", "foo_tbl")).thenReturn(Optional.of("foo_col_2"));
+ when(rule.findShardingColumn("foo_col_2", "foo_tbl")).thenReturn(Optional.of("foo_col_2"));
List<ShardingCondition> actual = shardingConditionEngine.createShardingConditions(insertStatementContext, Collections.emptyList());
assertThat(actual.size(), is(1));
assertThat(actual.get(0).getValues().size(), is(1));
@@ -211,7 +213,7 @@ class InsertClauseShardingConditionEngineTest {
@Test
void assertCreateShardingConditionsWithCaseSensitiveField() {
- when(shardingRule.findShardingColumn("foo_Col_3", "foo_tbl")).thenReturn(Optional.of("foo_Col_3"));
+ when(rule.findShardingColumn("foo_Col_3", "foo_tbl")).thenReturn(Optional.of("foo_Col_3"));
List<ShardingCondition> actual = shardingConditionEngine.createShardingConditions(insertStatementContext, Collections.emptyList());
assertThat(actual.size(), is(1));
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTable.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTable.java
index ee34246c6a2..4fc8165200d 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTable.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTable.java
@@ -27,7 +27,9 @@ import org.apache.shardingsphere.infra.metadata.identifier.ShardingSphereIdentif
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -130,6 +132,21 @@ public final class ShardingSphereTable {
return columns.values();
}
+ /**
+ * Find column names If not existed from passing by column names.
+ *
+ * @param columnNames column names
+ * @return found column names
+ */
+ public Collection<String> findColumnNamesIfNotExistedFrom(final Collection<String> columnNames) {
+ if (columnNames.size() == columns.size()) {
+ return Collections.emptyList();
+ }
+ Collection<ShardingSphereIdentifier> result = new LinkedHashSet<>(columns.keySet());
+ result.removeAll(columnNames.stream().map(ShardingSphereIdentifier::new).collect(Collectors.toSet()));
+ return result.stream().map(ShardingSphereIdentifier::getValue).collect(Collectors.toList());
+ }
+
/**
* Judge whether contains index.
*
diff --git a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTableTest.java b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTableTest.java
index 084c63bf1b6..3090050d707 100644
--- a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTableTest.java
+++ b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTableTest.java
@@ -30,16 +30,31 @@ import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.mock;
class ShardingSphereTableTest {
@Test
void assertGetColumn() {
ShardingSphereColumn column = new ShardingSphereColumn("foo_col", Types.INTEGER, true, true, false, true, false, false);
- ShardingSphereTable shardingSphereTable = new ShardingSphereTable("foo_tbl", Collections.singleton(column), Collections.emptyList(), Collections.emptyList());
- assertThat(shardingSphereTable.getColumn("foo_col"), is(column));
- assertThat(shardingSphereTable.getColumn("FOO_COL"), is(column));
- assertNull(shardingSphereTable.getColumn("invalid"));
+ ShardingSphereTable table = new ShardingSphereTable("foo_tbl", Collections.singleton(column), Collections.emptyList(), Collections.emptyList());
+ assertThat(table.getColumn("foo_col"), is(column));
+ assertThat(table.getColumn("FOO_COL"), is(column));
+ assertNull(table.getColumn("invalid"));
+ }
+
+ @Test
+ void assertFindColumnNamesIfNotExistedFromWithSameColumnSize() {
+ ShardingSphereTable table = new ShardingSphereTable("foo_tbl", Collections.singleton(mock()), Collections.emptyList(), Collections.emptyList());
+ assertTrue(table.findColumnNamesIfNotExistedFrom(Collections.singleton("foo_col")).isEmpty());
+ }
+
+ @Test
+ void assertFindColumnNamesIfNotExistedFromWithDifferentColumnSize() {
+ ShardingSphereColumn column1 = new ShardingSphereColumn("foo_col", Types.INTEGER, true, true, false, true, false, false);
+ ShardingSphereColumn column2 = new ShardingSphereColumn("bar_col", Types.INTEGER, true, true, false, true, false, false);
+ ShardingSphereTable table = new ShardingSphereTable("foo_tbl", Arrays.asList(column1, column2), Collections.emptyList(), Collections.emptyList());
+ assertThat(table.findColumnNamesIfNotExistedFrom(Collections.singleton("FOO_COL")), is(Collections.singletonList("bar_col")));
}
@Test
@@ -54,60 +69,60 @@ class ShardingSphereTableTest {
@Test
void assertContainsColumn() {
ShardingSphereColumn column = new ShardingSphereColumn("foo_col", Types.INTEGER, true, true, false, true, false, false);
- ShardingSphereTable shardingSphereTable = new ShardingSphereTable("foo_tbl", Collections.singleton(column), Collections.emptyList(), Collections.emptyList());
- assertTrue(shardingSphereTable.containsColumn("foo_col"));
- assertFalse(shardingSphereTable.containsColumn("invalid"));
+ ShardingSphereTable table = new ShardingSphereTable("foo_tbl", Collections.singleton(column), Collections.emptyList(), Collections.emptyList());
+ assertTrue(table.containsColumn("foo_col"));
+ assertFalse(table.containsColumn("invalid"));
}
@Test
void assertPutIndex() {
ShardingSphereIndex index1 = new ShardingSphereIndex("foo_idx_1", Collections.emptyList(), false);
ShardingSphereIndex index2 = new ShardingSphereIndex("foo_idx_2", Collections.emptyList(), false);
- ShardingSphereTable shardingSphereTable = new ShardingSphereTable("foo_tbl", Collections.emptyList(), Arrays.asList(index1, index2), Collections.emptyList());
- assertTrue(shardingSphereTable.containsIndex("foo_idx_1"));
- assertTrue(shardingSphereTable.containsIndex("foo_idx_2"));
- assertFalse(shardingSphereTable.containsIndex("invalid"));
- assertThat(shardingSphereTable.getAllIndexes(), hasSize(2));
+ ShardingSphereTable table = new ShardingSphereTable("foo_tbl", Collections.emptyList(), Arrays.asList(index1, index2), Collections.emptyList());
+ assertTrue(table.containsIndex("foo_idx_1"));
+ assertTrue(table.containsIndex("foo_idx_2"));
+ assertFalse(table.containsIndex("invalid"));
+ assertThat(table.getAllIndexes(), hasSize(2));
}
@Test
void assertGetIndex() {
ShardingSphereIndex index = new ShardingSphereIndex("foo_idx", Collections.emptyList(), false);
- ShardingSphereTable shardingSphereTable = new ShardingSphereTable("foo_tbl", Collections.emptyList(), Collections.singleton(index), Collections.emptyList());
- assertTrue(shardingSphereTable.containsIndex("foo_idx"));
- assertTrue(shardingSphereTable.containsIndex("FOO_IDX"));
- assertFalse(shardingSphereTable.containsIndex("invalid"));
+ ShardingSphereTable table = new ShardingSphereTable("foo_tbl", Collections.emptyList(), Collections.singleton(index), Collections.emptyList());
+ assertTrue(table.containsIndex("foo_idx"));
+ assertTrue(table.containsIndex("FOO_IDX"));
+ assertFalse(table.containsIndex("invalid"));
}
@Test
void assertRemoveIndex() {
ShardingSphereIndex index1 = new ShardingSphereIndex("foo_idx_1", Collections.emptyList(), false);
ShardingSphereIndex index2 = new ShardingSphereIndex("foo_idx_2", Collections.emptyList(), false);
- ShardingSphereTable shardingSphereTable = new ShardingSphereTable("foo_tbl", Collections.emptyList(), Arrays.asList(index1, index2), Collections.emptyList());
- shardingSphereTable.removeIndex("foo_idx_1");
- assertFalse(shardingSphereTable.containsIndex("foo_idx_1"));
- shardingSphereTable.removeIndex("invalid");
- assertTrue(shardingSphereTable.containsIndex("foo_idx_2"));
- assertThat(shardingSphereTable.getAllIndexes(), hasSize(1));
+ ShardingSphereTable table = new ShardingSphereTable("foo_tbl", Collections.emptyList(), Arrays.asList(index1, index2), Collections.emptyList());
+ table.removeIndex("foo_idx_1");
+ assertFalse(table.containsIndex("foo_idx_1"));
+ table.removeIndex("invalid");
+ assertTrue(table.containsIndex("foo_idx_2"));
+ assertThat(table.getAllIndexes(), hasSize(1));
}
@Test
void assertGetIndexes() {
ShardingSphereIndex index1 = new ShardingSphereIndex("foo_idx_1", Collections.emptyList(), false);
ShardingSphereIndex index2 = new ShardingSphereIndex("foo_idx_2", Collections.emptyList(), false);
- ShardingSphereTable shardingSphereTable = new ShardingSphereTable("foo_tbl", Collections.emptyList(), Arrays.asList(index1, index2), Collections.emptyList());
- assertThat(shardingSphereTable.getAllIndexes(), hasItems(index1, index2));
- assertThat(shardingSphereTable.getAllIndexes(), hasSize(2));
+ ShardingSphereTable table = new ShardingSphereTable("foo_tbl", Collections.emptyList(), Arrays.asList(index1, index2), Collections.emptyList());
+ assertThat(table.getAllIndexes(), hasItems(index1, index2));
+ assertThat(table.getAllIndexes(), hasSize(2));
}
@Test
void assertContainsIndex() {
ShardingSphereIndex index1 = new ShardingSphereIndex("foo_idx_1", Collections.emptyList(), false);
ShardingSphereIndex index2 = new ShardingSphereIndex("foo_idx_2", Collections.emptyList(), false);
- ShardingSphereTable shardingSphereTable = new ShardingSphereTable("foo_tbl", Collections.emptyList(), Arrays.asList(index1, index2), Collections.emptyList());
- assertTrue(shardingSphereTable.containsIndex("foo_idx_1"));
- assertTrue(shardingSphereTable.containsIndex("foo_idx_2"));
- assertFalse(shardingSphereTable.containsIndex("invalid"));
+ ShardingSphereTable table = new ShardingSphereTable("foo_tbl", Collections.emptyList(), Arrays.asList(index1, index2), Collections.emptyList());
+ assertTrue(table.containsIndex("foo_idx_1"));
+ assertTrue(table.containsIndex("foo_idx_2"));
+ assertFalse(table.containsIndex("invalid"));
}
@Test
diff --git a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
index 7d9d64607cb..d6bdd6a1c3e 100644
--- a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
+++ b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
@@ -132,8 +132,7 @@ public final class PostgreSQLComDescribeExecutor implements CommandExecutor {
String logicTableName = insertStatement.getTable().map(optional -> optional.getTableName().getIdentifier().getValue()).orElse("");
ShardingSphereTable table = getTableFromMetaData(connectionSession.getUsedDatabaseName(), insertStatement, logicTableName);
List<String> columnNamesOfInsert = getColumnNamesOfInsertStatement(insertStatement, table);
- preparedStatement.setRowDescription(returningSegment.<PostgreSQLPacket>map(returning -> describeReturning(returning, table))
- .orElseGet(PostgreSQLNoDataPacket::getInstance));
+ preparedStatement.setRowDescription(returningSegment.<PostgreSQLPacket>map(returning -> describeReturning(returning, table)).orElseGet(PostgreSQLNoDataPacket::getInstance));
int parameterMarkerIndex = 0;
for (InsertValuesSegment each : insertStatement.getValues()) {
ListIterator<ExpressionSegment> listIterator = each.getValues().listIterator();