diff --git a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/index/Index.java b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/index/Index.java index b398ad9657238..bd640fe7a2a84 100644 --- a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/index/Index.java +++ b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/index/Index.java @@ -17,13 +17,13 @@ package org.apache.spark.sql.connector.catalog.index; +import java.util.Collections; +import java.util.Map; + import org.apache.spark.annotation.Evolving; import org.apache.spark.sql.connector.catalog.Identifier; import org.apache.spark.sql.connector.expressions.FieldReference; -import java.util.Collections; -import java.util.Map; - /** * An Index in a table * @@ -32,21 +32,21 @@ @Evolving public class Index { private String indexName; - private FieldReference[] columns; - private Identifier table; private String indexType; + private Identifier table; + private FieldReference[] columns; private Map properties = Collections.emptyMap(); public Index( String indexName, - FieldReference[] columns, - Identifier table, String indexType, + Identifier table, + FieldReference[] columns, Map properties) { this.indexName = indexName; - this.columns = columns; - this.table = table; this.indexType = indexType; + this.table = table; + this.columns = columns; this.properties = properties; } @@ -56,9 +56,9 @@ public Index( String indexName() { return indexName; } /** - * @return the column(s) this Index is on. Could be multi columns (a multi-column index). + * @return the indexType of this Index. */ - FieldReference[] columns() { return columns; } + String indexType() { return indexType; } /** * @return the table this Index is on. @@ -66,9 +66,9 @@ public Index( Identifier table() { return table; } /** - * @return the indexType of this Index. + * @return the column(s) this Index is on. Could be multi columns (a multi-column index). */ - String indexType() { return indexType; } + FieldReference[] columns() { return columns; } /** * Returns the string map of index properties. diff --git a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/index/SupportsIndex.java b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/index/SupportsIndex.java index 8593b05d3aa85..b2cb25c4cb71e 100644 --- a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/index/SupportsIndex.java +++ b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/index/SupportsIndex.java @@ -17,6 +17,9 @@ package org.apache.spark.sql.connector.catalog.index; +import java.util.Map; +import java.util.Properties; + import org.apache.spark.annotation.Evolving; import org.apache.spark.sql.catalyst.analysis.IndexAlreadyExistsException; import org.apache.spark.sql.catalyst.analysis.NoSuchIndexException; @@ -25,9 +28,6 @@ import org.apache.spark.sql.connector.catalog.Identifier; import org.apache.spark.sql.connector.expressions.FieldReference; -import java.util.Map; -import java.util.Properties; - /** * Catalog methods for working with index * @@ -63,7 +63,8 @@ void createIndex(String indexName, * @throws NoSuchIndexException If the index does not exist (optional) * @throws UnsupportedOperationException If delete index is not a supported operation */ - default boolean deleteIndex(String indexName) throws UnsupportedOperationException { + default boolean deleteIndex(String indexName) + throws NoSuchIndexException, UnsupportedOperationException { throw new UnsupportedOperationException("Delete index is not supported."); }