From 900fb53fd09e07c7d6455ffdd630df7d9597bdff Mon Sep 17 00:00:00 2001 From: Clearvive Date: Fri, 19 Jan 2024 10:46:51 +0800 Subject: [PATCH] [#1339] feat(table): Add index for tables. --- .../gravitino/catalog/jdbc/JdbcCatalogOperations.java | 3 ++- .../catalog/lakehouse/iceberg/IcebergCatalogOperations.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalogOperations.java b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalogOperations.java index cc80dbc54f8..a82b3e98ee0 100644 --- a/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalogOperations.java +++ b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalogOperations.java @@ -34,6 +34,7 @@ import com.datastrato.gravitino.rel.TableCatalog; import com.datastrato.gravitino.rel.TableChange; import com.datastrato.gravitino.rel.expressions.Indexes.Index; +import com.datastrato.gravitino.rel.expressions.Indexes.Indexes; import com.datastrato.gravitino.rel.expressions.distributions.Distribution; import com.datastrato.gravitino.rel.expressions.distributions.Distributions; import com.datastrato.gravitino.rel.expressions.sorts.SortOrder; @@ -360,7 +361,7 @@ public Table createTable( Index[] indexes) throws NoSuchSchemaException, TableAlreadyExistsException { Preconditions.checkArgument( - null == indexes || indexes.length == 0, "jdbc-catalog does not support indexes"); + indexes == Indexes.EMPTY_INDEXES, "jdbc-catalog does not support indexes"); Preconditions.checkArgument( null == distribution || distribution == Distributions.NONE, "jdbc-catalog does not support distribution"); diff --git a/catalogs/catalog-lakehouse-iceberg/src/main/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/IcebergCatalogOperations.java b/catalogs/catalog-lakehouse-iceberg/src/main/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/IcebergCatalogOperations.java index c9435cbdb1e..8b6c24dfe36 100644 --- a/catalogs/catalog-lakehouse-iceberg/src/main/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/IcebergCatalogOperations.java +++ b/catalogs/catalog-lakehouse-iceberg/src/main/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/IcebergCatalogOperations.java @@ -27,6 +27,7 @@ import com.datastrato.gravitino.rel.TableCatalog; import com.datastrato.gravitino.rel.TableChange; import com.datastrato.gravitino.rel.expressions.Indexes.Index; +import com.datastrato.gravitino.rel.expressions.Indexes.Indexes; import com.datastrato.gravitino.rel.expressions.distributions.Distribution; import com.datastrato.gravitino.rel.expressions.distributions.Distributions; import com.datastrato.gravitino.rel.expressions.sorts.SortOrder; @@ -486,7 +487,7 @@ public Table createTable( Index[] indexes) throws NoSuchSchemaException, TableAlreadyExistsException { Preconditions.checkArgument( - null == indexes || indexes.length == 0, "iceberg-catalog does not support indexes"); + indexes == Indexes.EMPTY_INDEXES, "iceberg-catalog does not support indexes"); try { if (!Distributions.NONE.equals(distribution)) { throw new UnsupportedOperationException("Iceberg does not support distribution");