From 7e83e1b56c3803f1a890e2ad8049ad9e106e1cbe Mon Sep 17 00:00:00 2001 From: chenjian2664 Date: Tue, 10 Dec 2024 17:10:36 +0800 Subject: [PATCH 1/2] Reorder connector behavior in TestPostgreSqlConnectorTest --- .../plugin/postgresql/TestPostgreSqlConnectorTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlConnectorTest.java b/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlConnectorTest.java index 345ea11fe68..4e39f890ab8 100644 --- a/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlConnectorTest.java +++ b/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlConnectorTest.java @@ -137,10 +137,10 @@ protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior) case SUPPORTS_CANCELLATION, SUPPORTS_JOIN_PUSHDOWN, SUPPORTS_JOIN_PUSHDOWN_WITH_VARCHAR_EQUALITY, - SUPPORTS_TOPN_PUSHDOWN, - SUPPORTS_TOPN_PUSHDOWN_WITH_VARCHAR, + SUPPORTS_MERGE, SUPPORTS_ROW_LEVEL_UPDATE, - SUPPORTS_MERGE -> true; + SUPPORTS_TOPN_PUSHDOWN, + SUPPORTS_TOPN_PUSHDOWN_WITH_VARCHAR -> true; case SUPPORTS_ADD_COLUMN_WITH_COMMENT, SUPPORTS_CREATE_TABLE_WITH_COLUMN_COMMENT, SUPPORTS_JOIN_PUSHDOWN_WITH_FULL_JOIN, From d95b8bf1ac08244c942c8b46cab6b50db34b3117 Mon Sep 17 00:00:00 2001 From: chenjian2664 Date: Tue, 10 Dec 2024 17:12:32 +0800 Subject: [PATCH 2/2] Inline method addPrimaryKeyToCopyTable Inline method `addPrimaryKeyToCopyTable` in `TestPostgreSqlJdbcConnectionAccesses` and `TestPostgreSqlJdbcConnectionCreation` for readability --- .../postgresql/TestPostgreSqlJdbcConnectionAccesses.java | 7 +------ .../postgresql/TestPostgreSqlJdbcConnectionCreation.java | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionAccesses.java b/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionAccesses.java index e09d7324c60..ad85f01582d 100644 --- a/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionAccesses.java +++ b/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionAccesses.java @@ -130,17 +130,12 @@ private void testJdbcMergeConnectionCreations() { assertJdbcConnections("CREATE TABLE copy_of_customer AS SELECT * FROM customer", 15, Optional.empty()); - addPrimaryKeyToCopyTable(); + postgreSqlServer.execute("ALTER TABLE copy_of_customer ADD CONSTRAINT t_copy_of_customer PRIMARY KEY (custkey)"); assertJdbcConnections("DELETE FROM copy_of_customer WHERE abs(custkey) = 1", 24, Optional.empty()); assertJdbcConnections("UPDATE copy_of_customer SET name = 'POLAND' WHERE abs(custkey) = 1", 32, Optional.empty()); assertJdbcConnections("MERGE INTO copy_of_customer c USING customer r ON r.custkey = c.custkey WHEN MATCHED THEN DELETE", 28, Optional.empty()); } - private void addPrimaryKeyToCopyTable() - { - postgreSqlServer.execute("ALTER TABLE copy_of_customer ADD CONSTRAINT t_copy_of_customer PRIMARY KEY (custkey)"); - } - private static final class TestingPostgreSqlModule extends AbstractConfigurationAwareModule { diff --git a/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionCreation.java b/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionCreation.java index 7afea0c3a52..2454b0ef6da 100644 --- a/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionCreation.java +++ b/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionCreation.java @@ -127,17 +127,12 @@ private void testJdbcMergeConnectionCreations() { assertJdbcConnections("CREATE TABLE copy_of_customer AS SELECT * FROM customer", 6, Optional.empty()); - addPrimaryKeyToCopyTable(); + postgreSqlServer.execute("ALTER TABLE copy_of_customer ADD CONSTRAINT t_copy_of_nation PRIMARY KEY (custkey)"); assertJdbcConnections("DELETE FROM copy_of_customer WHERE abs(custkey) = 1", 17, Optional.empty()); assertJdbcConnections("UPDATE copy_of_customer SET name = 'POLAND' WHERE abs(custkey) = 1", 25, Optional.empty()); assertJdbcConnections("MERGE INTO copy_of_customer c USING customer r ON r.custkey = c.custkey WHEN MATCHED THEN DELETE", 18, Optional.empty()); } - private void addPrimaryKeyToCopyTable() - { - postgreSqlServer.execute("ALTER TABLE copy_of_customer ADD CONSTRAINT t_copy_of_nation PRIMARY KEY (custkey)"); - } - private static final class TestingPostgreSqlModule extends AbstractConfigurationAwareModule {