You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/04/12 12:01:52 UTC

[shardingsphere] branch master updated: Use static map instead of string parse in PostgreSQLArrayColumnType init values (#10051)

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 accc4c6  Use static map instead of string parse in PostgreSQLArrayColumnType init values (#10051)
accc4c6 is described below

commit accc4c66ec72ad958d1ed3eee3ae5d0bc459aa80
Author: Liang Zhang <te...@163.com>
AuthorDate: Mon Apr 12 20:01:13 2021 +0800

    Use static map instead of string parse in PostgreSQLArrayColumnType init values (#10051)
    
    * Revise java doc
    
    * Fix generic type
    
    * Use static map instead of string parse in PostgreSQLArrayColumnType init values
---
 .../db/protocol/codec/PacketCodec.java             |   4 +-
 .../db/protocol/error/CommonErrorCode.java         |   2 +-
 .../constant/PostgreSQLArrayColumnType.java        | 185 ++++++++++-----------
 .../command/query/PostgreSQLColumnDescription.java |   2 +-
 .../constant/PostgreSQLArrayColumnTypeTest.java    |  10 +-
 .../frontend/netty/ServerHandlerInitializer.java   |   2 +-
 .../proxy/frontend/mysql/MySQLFrontendEngine.java  |   3 +-
 .../postgresql/PostgreSQLFrontendEngine.java       |   3 +-
 8 files changed, 102 insertions(+), 109 deletions(-)

diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/codec/PacketCodec.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/codec/PacketCodec.java
index a1be8d2..e11b1be 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/codec/PacketCodec.java
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/codec/PacketCodec.java
@@ -32,7 +32,7 @@ import java.util.List;
  */
 @RequiredArgsConstructor
 @Slf4j
-public final class PacketCodec extends ByteToMessageCodec<DatabasePacket> {
+public final class PacketCodec extends ByteToMessageCodec<DatabasePacket<?>> {
     
     private final DatabasePacketCodecEngine databasePacketCodecEngine;
     
@@ -50,7 +50,7 @@ public final class PacketCodec extends ByteToMessageCodec<DatabasePacket> {
     
     @SuppressWarnings("unchecked")
     @Override
-    protected void encode(final ChannelHandlerContext context, final DatabasePacket message, final ByteBuf out) {
+    protected void encode(final ChannelHandlerContext context, final DatabasePacket<?> message, final ByteBuf out) {
         databasePacketCodecEngine.encode(context, message, out);
         if (log.isDebugEnabled()) {
             log.debug("Write to client {} : \n {}", context.channel().id().asShortText(), ByteBufUtil.prettyHexDump(out));
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
index 05773ce..0646600 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
@@ -32,7 +32,7 @@ public enum CommonErrorCode implements SQLErrorCode {
     SHARDING_TABLE_RULES_NOT_EXISTED(1101, "C1101", "Sharding table rule %s is not exist."),
     
     TABLES_IN_USED(1102, "C1102", "Can not drop rule, tables %s in the rule are still in used."),
-
+    
     RESOURCE_IN_USED(1103, "C1103", "Can not drop resources, resources %s in the rule are still in used."),
     
     RESOURCE_NOT_EXIST(1104, "C1104", "Can not drop resources, resources %s do not exist."),
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLArrayColumnType.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLArrayColumnType.java
index cf527fa..5e4fd87 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLArrayColumnType.java
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLArrayColumnType.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.db.protocol.postgresql.constant;
 
+import com.google.common.base.Preconditions;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 
@@ -29,111 +30,103 @@ import java.util.Map;
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
 public final class PostgreSQLArrayColumnType {
     
-    private static final String ORIGINAL_RECORD_LINES =
-        "_aclitem 1034\n"
-            + "_array_tc_0 16425\n"
-            + "_array_tc_1 16433\n"
-            + "_bit 1561\n"
-            + "_bool 1000\n"
-            + "_box 1020\n"
-            + "_bpchar 1014\n"
-            + "_bytea 1001\n"
-            + "_cardinal_number 13031\n"
-            + "_char 1002\n"
-            + "_character_data 13034\n"
-            + "_cid 1012\n"
-            + "_cidr 651\n"
-            + "_circle 719\n"
-            + "_cstring 1263\n"
-            + "_date 1182\n"
-            + "_daterange 3913\n"
-            + "_float4 1021\n"
-            + "_float8 1022\n"
-            + "_gtsvector 3644\n"
-            + "_inet 1041\n"
-            + "_int2 1005\n"
-            + "_int2vector 1006\n"
-            + "_int4 1007\n"
-            + "_int4range 3905\n"
-            + "_int8 1016\n"
-            + "_int8range 3927\n"
-            + "_interval 1187\n"
-            + "_json 199\n"
-            + "_jsonb 3807\n"
-            + "_jsonpath 4073\n"
-            + "_line 629\n"
-            + "_lseg 1018\n"
-            + "_macaddr 1040\n"
-            + "_macaddr8 775\n"
-            + "_money 791\n"
-            + "_name 1003\n"
-            + "_numeric 1231\n"
-            + "_numrange 3907\n"
-            + "_oid 1028\n"
-            + "_oidvector 1013\n"
-            + "_path 1019\n"
-            + "_pg_foreign_data_wrappers 13265\n"
-            + "_pg_foreign_servers 13274\n"
-            + "_pg_foreign_table_columns 13258\n"
-            + "_pg_foreign_tables 13284\n"
-            + "_pg_lsn 3221\n"
-            + "_pg_user_mappings 13294\n"
-            + "_point 1017\n"
-            + "_polygon 1027\n"
-            + "_record 2287\n"
-            + "_refcursor 2201\n"
-            + "_regclass 2210\n"
-            + "_regconfig 3735\n"
-            + "_regdictionary 3770\n"
-            + "_regnamespace 4090\n"
-            + "_regoper 2208\n"
-            + "_regoperator 2209\n"
-            + "_regproc 1008\n"
-            + "_regprocedure 2207\n"
-            + "_regrole 4097\n"
-            + "_regtype 2211\n"
-            + "_sql_identifier 13036\n"
-            + "_test_array 16395\n"
-            + "_text 1009\n"
-            + "_tid 1010\n"
-            + "_time 1183\n"
-            + "_time_stamp 13041\n"
-            + "_timestamp 1115\n"
-            + "_timestamptz 1185\n"
-            + "_timetz 1270\n"
-            + "_tsquery 3645\n"
-            + "_tsrange 3909\n"
-            + "_tstzrange 3911\n"
-            + "_tsvector 3643\n"
-            + "_txid_snapshot 2949\n"
-            + "_uuid 2951\n"
-            + "_varbit 1563\n"
-            + "_varchar 1015\n"
-            + "_xid 1011\n"
-            + "_xml 143\n"
-            + "_yes_or_no 13043";
-    
-    private static final Map<String, Integer> COLUMN_TYPE_NAME_OID_MAP = new HashMap<>(128, 1.0F);
+    private static final Map<String, Integer> COLUMN_TYPE_NAME_OID_MAP = new HashMap<>(128, 1);
     
+    // CHECKSTYLE:OFF
     static {
-        for (String line : ORIGINAL_RECORD_LINES.split("\n")) {
-            String[] values = line.split(" ");
-            COLUMN_TYPE_NAME_OID_MAP.put(values[0], Integer.parseInt(values[1]));
-        }
+        COLUMN_TYPE_NAME_OID_MAP.put("_aclitem", 1034);
+        COLUMN_TYPE_NAME_OID_MAP.put("_array_tc_0", 16425);
+        COLUMN_TYPE_NAME_OID_MAP.put("_array_tc_1", 16433);
+        COLUMN_TYPE_NAME_OID_MAP.put("_bit", 1561);
+        COLUMN_TYPE_NAME_OID_MAP.put("_bool", 1000);
+        COLUMN_TYPE_NAME_OID_MAP.put("_box", 1020);
+        COLUMN_TYPE_NAME_OID_MAP.put("_bpchar", 1014);
+        COLUMN_TYPE_NAME_OID_MAP.put("_bytea", 1001);
+        COLUMN_TYPE_NAME_OID_MAP.put("_cardinal_number", 13031);
+        COLUMN_TYPE_NAME_OID_MAP.put("_char", 1002);
+        COLUMN_TYPE_NAME_OID_MAP.put("_character_data", 13034);
+        COLUMN_TYPE_NAME_OID_MAP.put("_cid", 1012);
+        COLUMN_TYPE_NAME_OID_MAP.put("_cidr", 651);
+        COLUMN_TYPE_NAME_OID_MAP.put("_circle", 719);
+        COLUMN_TYPE_NAME_OID_MAP.put("_cstring", 1263);
+        COLUMN_TYPE_NAME_OID_MAP.put("_date", 1182);
+        COLUMN_TYPE_NAME_OID_MAP.put("_daterange", 3913);
+        COLUMN_TYPE_NAME_OID_MAP.put("_float4", 1021);
+        COLUMN_TYPE_NAME_OID_MAP.put("_float8", 1022);
+        COLUMN_TYPE_NAME_OID_MAP.put("_gtsvector", 3644);
+        COLUMN_TYPE_NAME_OID_MAP.put("_inet", 1041);
+        COLUMN_TYPE_NAME_OID_MAP.put("_int2", 1005);
+        COLUMN_TYPE_NAME_OID_MAP.put("_int2vector", 1006);
+        COLUMN_TYPE_NAME_OID_MAP.put("_int4", 1007);
+        COLUMN_TYPE_NAME_OID_MAP.put("_int4range", 3905);
+        COLUMN_TYPE_NAME_OID_MAP.put("_int8", 1016);
+        COLUMN_TYPE_NAME_OID_MAP.put("_int8range", 3927);
+        COLUMN_TYPE_NAME_OID_MAP.put("_interval", 1187);
+        COLUMN_TYPE_NAME_OID_MAP.put("_json", 199);
+        COLUMN_TYPE_NAME_OID_MAP.put("_jsonb", 3807);
+        COLUMN_TYPE_NAME_OID_MAP.put("_jsonpath", 4073);
+        COLUMN_TYPE_NAME_OID_MAP.put("_line", 629);
+        COLUMN_TYPE_NAME_OID_MAP.put("_lseg", 1018);
+        COLUMN_TYPE_NAME_OID_MAP.put("_macaddr", 1040);
+        COLUMN_TYPE_NAME_OID_MAP.put("_macaddr8", 775);
+        COLUMN_TYPE_NAME_OID_MAP.put("_money", 791);
+        COLUMN_TYPE_NAME_OID_MAP.put("_name", 1003);
+        COLUMN_TYPE_NAME_OID_MAP.put("_numeric", 1231);
+        COLUMN_TYPE_NAME_OID_MAP.put("_numrange", 3907);
+        COLUMN_TYPE_NAME_OID_MAP.put("_oid", 1028);
+        COLUMN_TYPE_NAME_OID_MAP.put("_oidvector", 1013);
+        COLUMN_TYPE_NAME_OID_MAP.put("_path", 1019);
+        COLUMN_TYPE_NAME_OID_MAP.put("_pg_foreign_data_wrappers", 13265);
+        COLUMN_TYPE_NAME_OID_MAP.put("_pg_foreign_servers", 13274);
+        COLUMN_TYPE_NAME_OID_MAP.put("_pg_foreign_table_columns", 13258);
+        COLUMN_TYPE_NAME_OID_MAP.put("_pg_foreign_tables", 13284);
+        COLUMN_TYPE_NAME_OID_MAP.put("_pg_lsn", 3221);
+        COLUMN_TYPE_NAME_OID_MAP.put("_pg_user_mappings", 13294);
+        COLUMN_TYPE_NAME_OID_MAP.put("_point", 1017);
+        COLUMN_TYPE_NAME_OID_MAP.put("_polygon", 1027);
+        COLUMN_TYPE_NAME_OID_MAP.put("_record", 2287);
+        COLUMN_TYPE_NAME_OID_MAP.put("_refcursor", 2201);
+        COLUMN_TYPE_NAME_OID_MAP.put("_regclass", 2210);
+        COLUMN_TYPE_NAME_OID_MAP.put("_regconfig", 3735);
+        COLUMN_TYPE_NAME_OID_MAP.put("_regdictionary", 3770);
+        COLUMN_TYPE_NAME_OID_MAP.put("_regnamespace", 4090);
+        COLUMN_TYPE_NAME_OID_MAP.put("_regoper", 2208);
+        COLUMN_TYPE_NAME_OID_MAP.put("_regoperator", 2209);
+        COLUMN_TYPE_NAME_OID_MAP.put("_regproc", 1008);
+        COLUMN_TYPE_NAME_OID_MAP.put("_regprocedure", 2207);
+        COLUMN_TYPE_NAME_OID_MAP.put("_regrole", 4097);
+        COLUMN_TYPE_NAME_OID_MAP.put("_regtype", 2211);
+        COLUMN_TYPE_NAME_OID_MAP.put("_sql_identifier", 13036);
+        COLUMN_TYPE_NAME_OID_MAP.put("_test_array", 16395);
+        COLUMN_TYPE_NAME_OID_MAP.put("_text", 1009);
+        COLUMN_TYPE_NAME_OID_MAP.put("_tid", 1010);
+        COLUMN_TYPE_NAME_OID_MAP.put("_time", 1183);
+        COLUMN_TYPE_NAME_OID_MAP.put("_time_stamp", 13041);
+        COLUMN_TYPE_NAME_OID_MAP.put("_timestamp", 1115);
+        COLUMN_TYPE_NAME_OID_MAP.put("_timestamptz", 1185);
+        COLUMN_TYPE_NAME_OID_MAP.put("_timetz", 1270);
+        COLUMN_TYPE_NAME_OID_MAP.put("_tsquery", 3645);
+        COLUMN_TYPE_NAME_OID_MAP.put("_tsrange", 3909);
+        COLUMN_TYPE_NAME_OID_MAP.put("_tstzrange", 3911);
+        COLUMN_TYPE_NAME_OID_MAP.put("_tsvector", 3643);
+        COLUMN_TYPE_NAME_OID_MAP.put("_txid_snapshot", 2949);
+        COLUMN_TYPE_NAME_OID_MAP.put("_uuid", 2951);
+        COLUMN_TYPE_NAME_OID_MAP.put("_varbit", 1563);
+        COLUMN_TYPE_NAME_OID_MAP.put("_varchar", 1015);
+        COLUMN_TYPE_NAME_OID_MAP.put("_xid", 1011);
+        COLUMN_TYPE_NAME_OID_MAP.put("_xml", 143);
+        COLUMN_TYPE_NAME_OID_MAP.put("_yes_or_no", 13043);
     }
+    // CHECKSTYLE:ON
     
     /**
      * Get type oid by database-specific column type name.
      *
      * @param columnTypeName PostgreSQL column type name, e.g. {@code int4}
      * @return type oid, e.g. {@code 23} for {@code int4}
-     * @throws IllegalArgumentException if no type oid could be found
      */
-    public static int getTypeOidByColumnTypeName(final String columnTypeName) throws IllegalArgumentException {
-        if (COLUMN_TYPE_NAME_OID_MAP.containsKey(columnTypeName)) {
-            return COLUMN_TYPE_NAME_OID_MAP.get(columnTypeName);
-        }
-        throw new IllegalArgumentException(String.format("Cannot find PostgreSQL type oid for columnTypeName '%s'", columnTypeName));
+    public static int getTypeOid(final String columnTypeName) {
+        Preconditions.checkArgument(COLUMN_TYPE_NAME_OID_MAP.containsKey(columnTypeName), "Cannot find PostgreSQL type oid for columnTypeName '%s'", columnTypeName);
+        return COLUMN_TYPE_NAME_OID_MAP.get(columnTypeName);
     }
-    
 }
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLColumnDescription.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLColumnDescription.java
index 6201a0a..9684429 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLColumnDescription.java
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLColumnDescription.java
@@ -47,6 +47,6 @@ public final class PostgreSQLColumnDescription {
         this.columnName = columnName;
         this.columnIndex = columnIndex;
         this.columnLength = columnLength;
-        typeOID = Types.ARRAY == columnType ? PostgreSQLArrayColumnType.getTypeOidByColumnTypeName(columnTypeName) : PostgreSQLBinaryColumnType.valueOfJDBCType(columnType).getValue();
+        typeOID = Types.ARRAY == columnType ? PostgreSQLArrayColumnType.getTypeOid(columnTypeName) : PostgreSQLBinaryColumnType.valueOfJDBCType(columnType).getValue();
     }
 }
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLArrayColumnTypeTest.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLArrayColumnTypeTest.java
index 4b05d88..25222e4 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLArrayColumnTypeTest.java
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLArrayColumnTypeTest.java
@@ -25,14 +25,12 @@ import static org.junit.Assert.assertThat;
 public final class PostgreSQLArrayColumnTypeTest {
     
     @Test
-    public void assertIntegerArrayGot() {
-        int columnTypeName = PostgreSQLArrayColumnType.getTypeOidByColumnTypeName("_int4");
-        assertThat(columnTypeName, is(1007));
+    public void assertGetTypeOidSuccess() {
+        assertThat(PostgreSQLArrayColumnType.getTypeOid("_int4"), is(1007));
     }
     
     @Test(expected = IllegalArgumentException.class)
-    public void assertIllegalArgExThrown() {
-        PostgreSQLArrayColumnType.getTypeOidByColumnTypeName("not_exist_type");
+    public void assertGetTypeOidFailed() {
+        PostgreSQLArrayColumnType.getTypeOid("not_exist_type");
     }
-    
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializer.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializer.java
index e6b0a01..ffe54ac 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializer.java
@@ -27,7 +27,7 @@ import org.apache.shardingsphere.proxy.frontend.protocol.DatabaseProtocolFronten
 import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
 
 /**
- * Channel initializer.
+ * Server handler initializer.
  */
 @RequiredArgsConstructor
 public final class ServerHandlerInitializer extends ChannelInitializer<SocketChannel> {
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngine.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngine.java
index 176c2b8..bd586b3 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngine.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngine.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.proxy.frontend.mysql;
 import lombok.Getter;
 import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
 import org.apache.shardingsphere.db.protocol.mysql.codec.MySQLPacketCodecEngine;
+import org.apache.shardingsphere.db.protocol.mysql.packet.MySQLPacket;
 import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
 import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
 import org.apache.shardingsphere.proxy.frontend.mysql.authentication.MySQLAuthenticationEngine;
@@ -38,7 +39,7 @@ public final class MySQLFrontendEngine implements DatabaseProtocolFrontendEngine
     
     private final MySQLCommandExecuteEngine commandExecuteEngine = new MySQLCommandExecuteEngine();
     
-    private final DatabasePacketCodecEngine<?> codecEngine = new MySQLPacketCodecEngine();
+    private final DatabasePacketCodecEngine<MySQLPacket> codecEngine = new MySQLPacketCodecEngine();
     
     @Override
     public void release(final BackendConnection backendConnection) {
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java
index 5b94b7d..30bc590 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.proxy.frontend.postgresql;
 import lombok.Getter;
 import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
 import org.apache.shardingsphere.db.protocol.postgresql.codec.PostgreSQLPacketCodecEngine;
+import org.apache.shardingsphere.db.protocol.postgresql.packet.PostgreSQLPacket;
 import org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.binary.BinaryStatementRegistry;
 import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
 import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
@@ -39,7 +40,7 @@ public final class PostgreSQLFrontendEngine implements DatabaseProtocolFrontendE
     
     private final PostgreSQLCommandExecuteEngine commandExecuteEngine = new PostgreSQLCommandExecuteEngine();
     
-    private final DatabasePacketCodecEngine<?> codecEngine = new PostgreSQLPacketCodecEngine();
+    private final DatabasePacketCodecEngine<PostgreSQLPacket> codecEngine = new PostgreSQLPacketCodecEngine();
     
     @Override
     public void release(final BackendConnection backendConnection) {