From 862ac70ba6b4f7a4e68cb89bea66219de36b2993 Mon Sep 17 00:00:00 2001 From: Clearvive Date: Thu, 1 Feb 2024 10:05:44 +0800 Subject: [PATCH] [#1736] feat(postgresql): Support PostgreSQL index. --- .../gravitino/catalog/jdbc/operation/JdbcTableOperations.java | 1 + .../integration/test/catalog/jdbc/mysql/CatalogMysqlIT.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/operation/JdbcTableOperations.java b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/operation/JdbcTableOperations.java index 233de2a265e..7ba2288230f 100644 --- a/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/operation/JdbcTableOperations.java +++ b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/operation/JdbcTableOperations.java @@ -265,6 +265,7 @@ protected List getIndexes(String databaseName, String tableName, Database ResultSet indexInfo = getIndexInfo(databaseName, tableName, metaData); while (indexInfo.next()) { String indexName = indexInfo.getString("INDEX_NAME"); + // The primary key is also the unique key, so we need to filter the primary key here. if (!indexInfo.getBoolean("NON_UNIQUE") && !primaryIndexNames.contains(indexName)) { jdbcIndexBeans.add( new JdbcIndexBean( diff --git a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/catalog/jdbc/mysql/CatalogMysqlIT.java b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/catalog/jdbc/mysql/CatalogMysqlIT.java index f7e97f48259..9318843c7f7 100644 --- a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/catalog/jdbc/mysql/CatalogMysqlIT.java +++ b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/catalog/jdbc/mysql/CatalogMysqlIT.java @@ -589,8 +589,8 @@ void testCreateTableIndex() { Indexes.unique("u2_key", new String[][] {{"col_3"}, {"col_4"}}), Indexes.unique("u3_key", new String[][] {{"col_5"}, {"col_4"}}), Indexes.unique("u4_key", new String[][] {{"col_2"}, {"col_3"}, {"col_4"}}), - Indexes.unique("u5_key", new String[][] {{"col_2"}, {"col_3"}, {"col_4"}}), - Indexes.unique("u6_key", new String[][] {{"col_1"}, {"col_2"}, {"col_3"}, {"col_4"}}), + Indexes.unique("u5_key", new String[][] {{"col_3"}, {"col_2"}, {"col_4"}}), + Indexes.unique("u6_key", new String[][] {{"col_3"}, {"col_4"}, {"col_1"}, {"col_2"}}), }; NameIdentifier tableIdentifier =