This is an automated email from the ASF dual-hosted git repository.
yx9o 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 c485d9be666 Inline MySQLCommandPacketTypeLoader and
PostgreSQLCommandPacketTypeLoader to CommandExecuteEngine (#25919)
c485d9be666 is described below
commit c485d9be666f4dbd9a21173c791b0bd81c0d7502
Author: Liang Zhang <[email protected]>
AuthorDate: Sun May 28 12:18:44 2023 +0800
Inline MySQLCommandPacketTypeLoader and PostgreSQLCommandPacketTypeLoader
to CommandExecuteEngine (#25919)
* Inline MySQLCommandPacketTypeLoader and PostgreSQLCommandPacketTypeLoader
to CommandExecuteEngine
* Move package of ComplexInlineShardingAlgorithm
* Refactor ComplexInlineShardingAlgorithm
---
.../command/MySQLCommandPacketTypeLoader.java | 39 ------------------
.../command/MySQLCommandPacketTypeLoaderTest.java | 44 --------------------
.../command/PostgreSQLCommandPacketTypeLoader.java | 39 ------------------
.../PostgreSQLCommandPacketTypeLoaderTest.java | 47 ----------------------
docs/document/content/dev-manual/sharding.cn.md | 2 +-
docs/document/content/dev-manual/sharding.en.md | 2 +-
.../startup/graalvm-native-image.cn.md | 4 +-
.../startup/graalvm-native-image.en.md | 4 +-
.../ComplexInlineShardingAlgorithm.java | 9 ++---
...e.shardingsphere.sharding.spi.ShardingAlgorithm | 6 +--
.../ComplexInlineShardingAlgorithmTest.java | 2 +-
.../mysql/command/MySQLCommandExecuteEngine.java | 5 +--
.../command/PostgreSQLCommandExecuteEngine.java | 5 +--
13 files changed, 18 insertions(+), 190 deletions(-)
diff --git
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLCommandPacketTypeLoader.java
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLCommandPacketTypeLoader.java
deleted file mode 100644
index 1035c53da6e..00000000000
---
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLCommandPacketTypeLoader.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.db.protocol.mysql.packet.command;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-
-/**
- * Command packet type loader for MySQL.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class MySQLCommandPacketTypeLoader {
-
- /**
- * Get command packet type.
- *
- * @param payload packet payload for MySQL
- * @return command packet type for MySQL
- */
- public static MySQLCommandPacketType getCommandPacketType(final
MySQLPacketPayload payload) {
- return MySQLCommandPacketType.valueOf(payload.readInt1());
- }
-}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLCommandPacketTypeLoaderTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLCommandPacketTypeLoaderTest.java
deleted file mode 100644
index 9a83d3086e7..00000000000
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLCommandPacketTypeLoaderTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.db.protocol.mysql.packet.command;
-
-import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-import org.junit.jupiter.api.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-class MySQLCommandPacketTypeLoaderTest {
-
- @Test
- void assertGetCommandPacketType() {
- MySQLPacketPayload payload = mock(MySQLPacketPayload.class);
-
when(payload.readInt1()).thenReturn(MySQLCommandPacketType.COM_QUIT.getValue());
- assertThat(MySQLCommandPacketTypeLoader.getCommandPacketType(payload),
is(MySQLCommandPacketType.COM_QUIT));
- }
-
- @Test
- void assertGetCommandPacketTypeError() {
- MySQLPacketPayload payload = mock(MySQLPacketPayload.class);
- when(payload.readInt1()).thenReturn(0x21);
- assertThrows(NullPointerException.class, () ->
MySQLCommandPacketTypeLoader.getCommandPacketType(payload));
- }
-}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeLoader.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeLoader.java
deleted file mode 100644
index d289738e795..00000000000
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeLoader.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.db.protocol.postgresql.packet.command;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-
-/**
- * Command packet type loader for PostgreSQL.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class PostgreSQLCommandPacketTypeLoader {
-
- /**
- * Get command packet type.
- *
- * @param payload packet payload for PostgreSQL
- * @return command packet type for PostgreSQL
- */
- public static PostgreSQLCommandPacketType getCommandPacketType(final
PostgreSQLPacketPayload payload) {
- return
PostgreSQLCommandPacketType.valueOf(payload.getByteBuf().getByte(payload.getByteBuf().readerIndex()));
- }
-}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeLoaderTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeLoaderTest.java
deleted file mode 100644
index fb6d522522c..00000000000
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeLoaderTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.db.protocol.postgresql.packet.command;
-
-import
org.apache.shardingsphere.db.protocol.postgresql.exception.PostgreSQLProtocolException;
-import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.jupiter.api.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-class PostgreSQLCommandPacketTypeLoaderTest {
-
- @Test
- void assertGetCommandPacketType() {
- PostgreSQLPacketPayload payload = mock(PostgreSQLPacketPayload.class,
RETURNS_DEEP_STUBS);
- when(payload.getByteBuf().getByte(anyInt())).thenReturn((byte) 'Q');
-
assertThat(PostgreSQLCommandPacketTypeLoader.getCommandPacketType(payload),
is(PostgreSQLCommandPacketType.SIMPLE_QUERY));
- }
-
- @Test
- void assertGetCommandPacketTypeError() {
- PostgreSQLPacketPayload payload = mock(PostgreSQLPacketPayload.class,
RETURNS_DEEP_STUBS);
- when(payload.getByteBuf().getByte(anyInt())).thenReturn((byte) 'a');
- assertThrows(PostgreSQLProtocolException.class, () ->
PostgreSQLCommandPacketTypeLoader.getCommandPacketType(payload));
- }
-}
diff --git a/docs/document/content/dev-manual/sharding.cn.md
b/docs/document/content/dev-manual/sharding.cn.md
index edb0e00480a..0f17628a138 100644
--- a/docs/document/content/dev-manual/sharding.cn.md
+++ b/docs/document/content/dev-manual/sharding.cn.md
@@ -27,7 +27,7 @@ chapter = true
| INTERVAL | N | 基于固定时间范围的分片算法 |
[`org.apache.shardingsphere.sharding.algorithm.sharding.datetime.IntervalShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java)
|
| CLASS_BASED | N | 基于自定义类的分片算法 |
[`org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithm.java)
|
| INLINE | N | 基于行表达式的分片算法 |
[`org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithm.java)
|
-| COMPLEX_INLINE | N | 基于行表达式的复合分片算法 |
[`org.apache.shardingsphere.sharding.algorithm.sharding.complex.ComplexInlineShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/complex/ComplexInlineShardingAlgorithm.java)
|
+| COMPLEX_INLINE | N | 基于行表达式的复合分片算法 |
[`org.apache.shardingsphere.sharding.algorithm.sharding.complex.ComplexInlineShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithm.java)
|
| HINT_INLINE | N | 基于行表达式的 Hint 分片算法 |
[`org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/hint/HintInlineShardingAlgorithm.java)
|
| COSID_MOD | N | 基于 CosId 的取模分片算法 |
[`org.apache.shardingsphere.sharding.cosid.algorithm.sharding.mod.CosIdModShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/mod/CosIdModShardingAlgorithm.java)
|
| COSID_INTERVAL | N | 基于 CosId 的固定时间范围的分片算法 |
[`org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.CosIdIntervalShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/CosIdIntervalShardingAlgorithm.java)
|
diff --git a/docs/document/content/dev-manual/sharding.en.md
b/docs/document/content/dev-manual/sharding.en.md
index e0a89ab106a..c9f2055e69a 100644
--- a/docs/document/content/dev-manual/sharding.en.md
+++ b/docs/document/content/dev-manual/sharding.en.md
@@ -27,7 +27,7 @@ Sharding Algorithm definition
| INTERVAL | N | Fixed interval sharding
algorithm |
[`org.apache.shardingsphere.sharding.algorithm.sharding.datetime.IntervalShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java)
|
| CLASS_BASED | N | Class based sharding
algorithm |
[`org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithm.java)
|
| INLINE | N | Inline sharding algorithm
|
[`org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithm.java)
|
-| COMPLEX_INLINE | N | Complex inline sharding
algorithm |
[`org.apache.shardingsphere.sharding.algorithm.sharding.complex.ComplexInlineShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/complex/ComplexInlineShardingAlgorithm.java)
|
+| COMPLEX_INLINE | N | Complex inline sharding
algorithm |
[`org.apache.shardingsphere.sharding.algorithm.sharding.complex.ComplexInlineShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithm.java)
|
| HINT_INLINE | N | Hint inline sharding
algorithm |
[`org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/hint/HintInlineShardingAlgorithm.java)
|
| COSID_MOD | N | Modulo sharding algorithm
provided by CosId |
[`org.apache.shardingsphere.sharding.cosid.algorithm.sharding.mod.CosIdModShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/mod/CosIdModShardingAlgorithm.java)
|
| COSID_INTERVAL | N | Fixed interval sharding
algorithm provided by CosId |
[`org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.CosIdIntervalShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/CosIdIntervalShardingAlgorithm.java)
|
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md
index ab1b3416397..76280844fc2 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md
@@ -36,9 +36,9 @@ services:
- 如下 3 个算法类由于涉及到 GraalVM Truffle Espresso 不方便在 host JVM 和 guest JVM 之间交互的
`groovy.lang.Closure`
类,暂未可在 GraalVM Native Image 下使用。
- -
`org.apache.shardingsphere.sharding.algorithm.sharding.complex.ComplexInlineShardingAlgorithm`
- -
`org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm`
-
`org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm`
+ -
`org.apache.shardingsphere.sharding.algorithm.sharding.inline.ComplexInlineShardingAlgorithm`
+ -
`org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm`
- 当前阶段,GraalVM Native Image 形态的 ShardingSphere Proxy 处于混合 AOT ( GraalVM Native
Image ) 和 JIT ( GraalVM
Truffle Espresso ) 运行的阶段。由于 https://github.com/oracle/graal/issues/4555
尚未关闭,GraalVM Truffle Espresso
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md
index 22c3113fd7c..db96726f75f 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md
@@ -41,9 +41,9 @@ services:
- The following three algorithm classes are not available under GraalVM Native
Image because they involve
the `groovy.lang.Closure` class that is inconvenient for GraalVM Truffle
Espresso to interact between the host JVM and
the guest JVM.
- -
`org.apache.shardingsphere.sharding.algorithm.sharding.complex.ComplexInlineShardingAlgorithm`
- -
`org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm`
-
`org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm`
+ -
`org.apache.shardingsphere.sharding.algorithm.sharding.inline.ComplexInlineShardingAlgorithm`
+ -
`org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm`
- At the current stage, ShardingSphere Proxy in GraalVM Native Image is in the
stage of mixed AOT ( GraalVM
Native Image ) and JIT ( GraalVM Truffle Espresso ) operation. Since
https://github.com/oracle/graal/issues/4555 has
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/complex/ComplexInlineShardingAlgorithm.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithm.java
similarity index 93%
rename from
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/complex/ComplexInlineShardingAlgorithm.java
rename to
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithm.java
index 9ee42aa1839..3158b8d2567 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/complex/ComplexInlineShardingAlgorithm.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithm.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.algorithm.sharding.complex;
+package org.apache.shardingsphere.sharding.algorithm.sharding.inline;
import groovy.lang.Closure;
import groovy.util.Expando;
@@ -87,8 +87,7 @@ public final class ComplexInlineShardingAlgorithm implements
ComplexKeysSharding
Map<String, Collection<Comparable<?>>> columnNameAndShardingValuesMap
= shardingValue.getColumnNameAndShardingValuesMap();
ShardingSpherePreconditions.checkState(shardingColumns.isEmpty() ||
shardingColumns.size() == columnNameAndShardingValuesMap.size(),
() -> new
MismatchedComplexInlineShardingAlgorithmColumnAndValueSizeException(shardingColumns.size(),
columnNameAndShardingValuesMap.size()));
- Collection<Map<String, Comparable<?>>> combine =
combine(columnNameAndShardingValuesMap);
- return
combine.stream().map(this::doSharding).collect(Collectors.toList());
+ return
combine(columnNameAndShardingValuesMap).stream().map(this::doSharding).collect(Collectors.toList());
}
private String doSharding(final Map<String, Comparable<?>> shardingValues)
{
@@ -100,9 +99,9 @@ public final class ComplexInlineShardingAlgorithm implements
ComplexKeysSharding
return closure.call().toString();
}
- private static <K, V> Collection<Map<K, V>> combine(final Map<K,
Collection<V>> map) {
+ private <K, V> Collection<Map<K, V>> combine(final Map<K, Collection<V>>
columnNameAndShardingValuesMap) {
Collection<Map<K, V>> result = new LinkedList<>();
- for (Entry<K, Collection<V>> entry : map.entrySet()) {
+ for (Entry<K, Collection<V>> entry :
columnNameAndShardingValuesMap.entrySet()) {
if (result.isEmpty()) {
for (V value : entry.getValue()) {
Map<K, V> item = new HashMap<>();
diff --git
a/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm
b/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm
index 2af81f319e6..7df57e13ae5 100644
---
a/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm
+++
b/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm
@@ -14,8 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
-org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm
+
org.apache.shardingsphere.sharding.algorithm.sharding.mod.ModShardingAlgorithm
org.apache.shardingsphere.sharding.algorithm.sharding.mod.HashModShardingAlgorithm
org.apache.shardingsphere.sharding.algorithm.sharding.range.VolumeBasedRangeShardingAlgorithm
@@ -23,5 +22,6 @@
org.apache.shardingsphere.sharding.algorithm.sharding.range.BoundaryBasedRangeSh
org.apache.shardingsphere.sharding.algorithm.sharding.datetime.AutoIntervalShardingAlgorithm
org.apache.shardingsphere.sharding.algorithm.sharding.datetime.IntervalShardingAlgorithm
org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithm
-org.apache.shardingsphere.sharding.algorithm.sharding.complex.ComplexInlineShardingAlgorithm
+org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm
+org.apache.shardingsphere.sharding.algorithm.sharding.inline.ComplexInlineShardingAlgorithm
org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/complex/ComplexInlineShardingAlgorithmTest.java
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithmTest.java
similarity index 98%
rename from
features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/complex/ComplexInlineShardingAlgorithmTest.java
rename to
features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithmTest.java
index 19e2e069de7..33da9f628e5 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/complex/ComplexInlineShardingAlgorithmTest.java
+++
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithmTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.algorithm.sharding.complex;
+package org.apache.shardingsphere.sharding.algorithm.sharding.inline;
import com.google.common.collect.Range;
import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
diff --git
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandExecuteEngine.java
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandExecuteEngine.java
index 5a529b073b4..80e6590e00e 100644
---
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandExecuteEngine.java
+++
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandExecuteEngine.java
@@ -21,12 +21,11 @@ import io.netty.channel.ChannelHandlerContext;
import org.apache.shardingsphere.db.protocol.mysql.packet.MySQLPacket;
import
org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacket;
import
org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacketType;
-import
org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacketTypeLoader;
import
org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLEofPacket;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
+import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
import org.apache.shardingsphere.db.protocol.packet.command.CommandPacket;
import org.apache.shardingsphere.db.protocol.packet.command.CommandPacketType;
-import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
import org.apache.shardingsphere.db.protocol.payload.PacketPayload;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
@@ -49,7 +48,7 @@ public final class MySQLCommandExecuteEngine implements
CommandExecuteEngine {
@Override
public MySQLCommandPacketType getCommandPacketType(final PacketPayload
payload) {
- return
MySQLCommandPacketTypeLoader.getCommandPacketType((MySQLPacketPayload) payload);
+ return MySQLCommandPacketType.valueOf(((MySQLPacketPayload)
payload).readInt1());
}
@Override
diff --git
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngine.java
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngine.java
index f40feb9f543..a1f6fcbc656 100644
---
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngine.java
+++
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngine.java
@@ -18,15 +18,14 @@
package org.apache.shardingsphere.proxy.frontend.postgresql.command;
import io.netty.channel.ChannelHandlerContext;
+import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
import org.apache.shardingsphere.db.protocol.packet.command.CommandPacket;
import org.apache.shardingsphere.db.protocol.packet.command.CommandPacketType;
-import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
import org.apache.shardingsphere.db.protocol.payload.PacketPayload;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.PostgreSQLPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketFactory;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
-import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketTypeLoader;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.PostgreSQLDataRowPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.generic.PostgreSQLCommandCompletePacket;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.generic.PostgreSQLReadyForQueryPacket;
@@ -52,7 +51,7 @@ public final class PostgreSQLCommandExecuteEngine implements
CommandExecuteEngin
@Override
public PostgreSQLCommandPacketType getCommandPacketType(final
PacketPayload payload) {
- return
PostgreSQLCommandPacketTypeLoader.getCommandPacketType((PostgreSQLPacketPayload)
payload);
+ return
PostgreSQLCommandPacketType.valueOf(payload.getByteBuf().getByte(payload.getByteBuf().readerIndex()));
}
@Override