World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#852] document(api, client): Add api and client java api docs (#1039)
Qi Yubbee3626e278
diff --git a/api/build.gradle.kts b/api/build.gradle.ktsindex babf66cea9..ae03117ce7 100644--- a/api/build.gradle.kts+++ b/api/build.gradle.kts@@ -21,3 +21,7 @@ dependencies {testImplementation(libs.junit.jupiter.params)testRuntimeOnly(libs.junit.jupiter.engine)}++tasks.build {+ dependsOn("javadoc")+}diff --git a/api/src/main/java/com/datastrato/gravitino/Audit.java b/api/src/main/java/com/datastrato/gravitino/Audit.javaindex dbbf3efb39..2867853b29 100644--- a/api/src/main/java/com/datastrato/gravitino/Audit.java+++ b/api/src/main/java/com/datastrato/gravitino/Audit.java@@ -9,15 +9,23 @@ import java.time.Instant;/** Represents the audit information of an entity. */public interface Audit {- /** The creator of the entity. */+ /**+ * The creator of the entity.+ *+ * @return the creator of the entity.+ */String creator();- /** The creation time of the entity. */+ /**+ * The creation time of the entity.+ *+ * @return The creation time of the entity.+ */Instant createTime();- /** The last modifier of the entity. */+ /** @return The last modifier of the entity. */String lastModifier();- /** The last modified time of the entity. */+ /** @return The last modified time of the entity. */Instant lastModifiedTime();}diff --git a/api/src/main/java/com/datastrato/gravitino/Auditable.java b/api/src/main/java/com/datastrato/gravitino/Auditable.javaindex 007b7b6987..2bfd7c7cc8 100644--- a/api/src/main/java/com/datastrato/gravitino/Auditable.java+++ b/api/src/main/java/com/datastrato/gravitino/Auditable.java@@ -4,8 +4,12 @@*/package com.datastrato.gravitino;+/**+ * An auditable entity is an entity that has audit information associated with it. This audit+ * information is used to track changes to the entity.+ */public interface Auditable {- /** Returns the audit information of the entity. */+ /** @return The audit information of the entity. */Audit auditInfo();}diff --git a/api/src/main/java/com/datastrato/gravitino/Catalog.java b/api/src/main/java/com/datastrato/gravitino/Catalog.javaindex 637667ddc0..ecd9546d5d 100644--- a/api/src/main/java/com/datastrato/gravitino/Catalog.java+++ b/api/src/main/java/com/datastrato/gravitino/Catalog.java@@ -8,8 +8,13 @@ import com.datastrato.gravitino.rel.SupportsSchemas;import com.datastrato.gravitino.rel.TableCatalog;import java.util.Map;+/**+ * The interface of a catalog. The catalog is the second level entity in the gravitino system,+ * containing a set of tables.+ */public interface Catalog extends Auditable {+ /** The type of the catalog. */enum Type {RELATIONAL, // Catalog Type for Relational Data Structure, like db.table, catalog.db.table.FILE, // Catalog Type for File System (including HDFS, S3, etc.), like path/to/file@@ -27,24 +32,28 @@ public interface Catalog extends Auditable {*/String PROPERTY_PACKAGE = "package";- /** The name of the catalog. */+ /** @return The name of the catalog. */String name();- /** The type of the catalog. */+ /** @return The type of the catalog. */Type type();- /** The provider of the catalog. */+ /** @return The provider of the catalog. */String provider();/*** The comment of the catalog. Note. this method will return null if the comment is not set for* this catalog.+ *+ * @return The comment of the catalog.*/String comment();/*** The properties of the catalog. Note, this method will return null if the properties are not* set.+ *+ * @return The properties of the catalog.*/Map<String, String> properties();@@ -52,14 +61,14 @@ public interface Catalog extends Auditable {* Return the {@link SupportsSchemas} if the catalog supports schema operations.** @throws UnsupportedOperationException if the catalog does not support schema operations.+ * @return The {@link SupportsSchemas} if the catalog supports schema operations.*/default SupportsSchemas asSchemas() throws UnsupportedOperationException {throw new UnsupportedOperationException("Catalog does not support schema operations");}/**- * return the {@link TableCatalog} if the catalog supports table operations.- *+ * @return the {@link TableCatalog} if the catalog supports table operations.* @throws UnsupportedOperationException if the catalog does not support table operations.*/default TableCatalog asTableCatalog() throws UnsupportedOperationException {diff --git a/api/src/main/java/com/datastrato/gravitino/CatalogChange.java b/api/src/main/java/com/datastrato/gravitino/CatalogChange.javaindex 41837e9513..6fe3027f72 100644--- a/api/src/main/java/com/datastrato/gravitino/CatalogChange.java+++ b/api/src/main/java/com/datastrato/gravitino/CatalogChange.java@@ -7,6 +7,10 @@ package com.datastrato.gravitino;import lombok.EqualsAndHashCode;import lombok.Getter;+/**+ * A catalog change is a change to a catalog. It can be used to rename a catalog, update the comment+ * of a catalog, set a property and value pair for a catalog, or remove a property from a catalog.+ */public interface CatalogChange {/**@@ -50,6 +54,7 @@ public interface CatalogChange {return new RemoveProperty(property);}+ /** A catalog change to rename the catalog. */@Getter@EqualsAndHashCodefinal class RenameCatalog implements CatalogChange {@@ -60,6 +65,7 @@ public interface CatalogChange {}}+ /** A catalog change to update the catalog comment. */@Getter@EqualsAndHashCodefinal class UpdateCatalogComment implements CatalogChange {@@ -70,6 +76,7 @@ public interface CatalogChange {}}+ /** A catalog change to set the property and value for the catalog. */@Getter@EqualsAndHashCodefinal class SetProperty implements CatalogChange {@@ -82,6 +89,7 @@ public interface CatalogChange {}}+ /** A catalog change to remove a property from the catalog. */@Getter@EqualsAndHashCodefinal class RemoveProperty implements CatalogChange {diff --git a/api/src/main/java/com/datastrato/gravitino/CatalogProvider.java b/api/src/main/java/com/datastrato/gravitino/CatalogProvider.javaindex deb2c364a7..2152ed1e1d 100644--- a/api/src/main/java/com/datastrato/gravitino/CatalogProvider.java+++ b/api/src/main/java/com/datastrato/gravitino/CatalogProvider.java@@ -13,6 +13,8 @@ public interface CatalogProvider {/*** The string that represents the catalog that this provider uses. This is overridden by children* to provide a nice alias for the catalog.+ *+ * @return The string that represents the catalog that this provider uses.*/String shortName();}diff --git a/api/src/main/java/com/datastrato/gravitino/Metalake.java b/api/src/main/java/com/datastrato/gravitino/Metalake.javaindex 5562c43a7e..24580e7ccb 100644--- a/api/src/main/java/com/datastrato/gravitino/Metalake.java+++ b/api/src/main/java/com/datastrato/gravitino/Metalake.java@@ -12,12 +12,26 @@ import java.util.Map;*/public interface Metalake extends Auditable {- /** The name of the metalake. */+ /**+ * The name of the metalake.+ *+ * @return The name of the metalake.+ */String name();- /** The comment of the metalake. */+ /**+ * The comment of the metalake. Note. this method will return null if the comment is not set for+ * this metalake.+ *+ * @return The comment of the metalake.+ */String comment();- /** The properties of the metalake. */+ /**+ * The properties of the metalake. Note, this method will return null if the properties are not+ * set.+ *+ * @return The properties of the metalake.+ */Map<String, String> properties();}diff --git a/api/src/main/java/com/datastrato/gravitino/MetalakeChange.java b/api/src/main/java/com/datastrato/gravitino/MetalakeChange.javaindex 1a5f4ac168..2ef2802147 100644--- a/api/src/main/java/com/datastrato/gravitino/MetalakeChange.java+++ b/api/src/main/java/com/datastrato/gravitino/MetalakeChange.java@@ -7,6 +7,11 @@ package com.datastrato.gravitino;import lombok.EqualsAndHashCode;import lombok.Getter;+/**+ * A metalake change is a change to a metalake. It can be used to rename a metalake, update the+ * comment of a metalake, set a property and value pair for a metalake, or remove a property from a+ * metalake.+ */public interface MetalakeChange {/**@@ -50,6 +55,7 @@ public interface MetalakeChange {return new RemoveProperty(property);}+ /** A metalake change to rename the metalake. */@Getter@EqualsAndHashCodefinal class RenameMetalake implements MetalakeChange {@@ -60,6 +66,7 @@ public interface MetalakeChange {}}+ /** A metalake change to update the metalake comment. */@Getter@EqualsAndHashCodefinal class UpdateMetalakeComment implements MetalakeChange {@@ -70,6 +77,7 @@ public interface MetalakeChange {}}+ /** A metalake change to set a property and value pair for the metalake. */@Getter@EqualsAndHashCodefinal class SetProperty implements MetalakeChange {@@ -82,6 +90,7 @@ public interface MetalakeChange {}}+ /** A metalake change to remove a property from the metalake. */@Getter@EqualsAndHashCodefinal class RemoveProperty implements MetalakeChange {diff --git a/api/src/main/java/com/datastrato/gravitino/NameIdentifier.java b/api/src/main/java/com/datastrato/gravitino/NameIdentifier.javaindex c67b88bbaf..5641dacc87 100644--- a/api/src/main/java/com/datastrato/gravitino/NameIdentifier.java+++ b/api/src/main/java/com/datastrato/gravitino/NameIdentifier.java@@ -9,6 +9,12 @@ import com.google.common.base.Splitter;import com.google.common.collect.Iterables;import java.util.Arrays;+/**+ * A name identifier is a sequence of names separated by dots. It's used to identify a metalake, a+ * catalog, a schema or a table. For example, "metalake1" can represent a metalake,+ * "metalake1.catalog1" can represent a catalog, "metalake1.catalog1.schema1" can represent a+ * schema.+ */public class NameIdentifier {private static final Splitter DOT = Splitter.on('.');@@ -158,17 +164,29 @@ public class NameIdentifier {this.name = name;}- /** Check if the {@link NameIdentifier} has a namespace. */+ /**+ * Check if the {@link NameIdentifier} has a namespace.+ *+ * @return True if the {@link NameIdentifier} has a namespace, false otherwise.+ */public boolean hasNamespace() {return !namespace.isEmpty();}- /** Get the namespace of the {@link NameIdentifier}. */+ /**+ * Get the namespace of the {@link NameIdentifier}.+ *+ * @return The namespace of the {@link NameIdentifier}.+ */public Namespace namespace() {return namespace;}- /** Get the name of the {@link NameIdentifier}. */+ /**+ * Get the name of the {@link NameIdentifier}.+ *+ * @return The name of the {@link NameIdentifier}.+ */public String name() {return name;}diff --git a/api/src/main/java/com/datastrato/gravitino/Namespace.java b/api/src/main/java/com/datastrato/gravitino/Namespace.javaindex d75a8f3ffd..c7857ea42a 100644--- a/api/src/main/java/com/datastrato/gravitino/Namespace.java+++ b/api/src/main/java/com/datastrato/gravitino/Namespace.java@@ -8,6 +8,11 @@ import com.datastrato.gravitino.exceptions.IllegalNamespaceException;import com.google.common.base.Joiner;import java.util.Arrays;+/**+ * A namespace is a sequence of levels separated by dots. It's used to identify a metalake, a+ * catalog or a schema. For example, "metalake1", "metalake1.catalog1" and+ * "metalake1.catalog1.schema1" are all valid namespaces.+ */public class Namespace {private static final Namespace EMPTY = new Namespace(new String[0]);@@ -15,7 +20,11 @@ public class Namespace {private final String[] levels;- /** Get an empty namespace. */+ /**+ * Get an empty namespace.+ *+ * @return An empty namespace+ */public static Namespace empty() {return EMPTY;}@@ -40,7 +49,11 @@ public class Namespace {return new Namespace(levels);}- /** Create a namespace for metalake. */+ /**+ * Create a namespace for metalake.+ *+ * @return A namespace for metalake+ */public static Namespace ofMetalake() {return empty();}@@ -137,7 +150,11 @@ public class Namespace {this.levels = levels;}- /** Get the levels of the namespace. */+ /**+ * Get the levels of the namespace.+ *+ * @return The levels of the namespace+ */public String[] levels() {return levels;}@@ -153,12 +170,20 @@ public class Namespace {return levels[pos];}- /** Get the length of the namespace. */+ /**+ * Get the length of the namespace.+ *+ * @return The length of the namespace.+ */public int length() {return levels.length;}- /** Check if the namespace is empty. */+ /**+ * Check if the namespace is empty.+ *+ * @return True if the namespace is empty, false otherwise.+ */public boolean isEmpty() {return levels.length == 0;}diff --git a/api/src/main/java/com/datastrato/gravitino/SupportsCatalogs.java b/api/src/main/java/com/datastrato/gravitino/SupportsCatalogs.javaindex d0dedb9331..5470307d91 100644--- a/api/src/main/java/com/datastrato/gravitino/SupportsCatalogs.java+++ b/api/src/main/java/com/datastrato/gravitino/SupportsCatalogs.java@@ -9,6 +9,10 @@ import com.datastrato.gravitino.exceptions.NoSuchCatalogException;import com.datastrato.gravitino.exceptions.NoSuchMetalakeException;import java.util.Map;+/**+ * Interface for supporting catalogs. It includes methods for listing, loading, creating, altering+ * and dropping catalogs.+ */public interface SupportsCatalogs {/**diff --git a/api/src/main/java/com/datastrato/gravitino/SupportsMetalakes.java b/api/src/main/java/com/datastrato/gravitino/SupportsMetalakes.javaindex ba69cfd7fa..7987af2c22 100644--- a/api/src/main/java/com/datastrato/gravitino/SupportsMetalakes.java+++ b/api/src/main/java/com/datastrato/gravitino/SupportsMetalakes.java@@ -8,9 +8,17 @@ import com.datastrato.gravitino.exceptions.MetalakeAlreadyExistsException;import com.datastrato.gravitino.exceptions.NoSuchMetalakeException;import java.util.Map;+/**+ * Interface for supporting metalakes. It includes methods for listing, loading, creating, altering+ * and dropping metalakes.+ */public interface SupportsMetalakes {- /** List all metalakes. */+ /**+ * List all metalakes.+ *+ * @return The list of metalakes.+ */Metalake[] listMetalakes();/**diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/AlreadyExistsException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/AlreadyExistsException.javaindex a40d458967..c2a83afe9d 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/AlreadyExistsException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/AlreadyExistsException.java@@ -4,6 +4,7 @@*/package com.datastrato.gravitino.exceptions;+/** An exception thrown when an entity or resource already exists. */public class AlreadyExistsException extends GravitinoRuntimeException {public AlreadyExistsException(String message) {diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/BadRequestException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/BadRequestException.javaindex 3d327b420c..b4095da35d 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/BadRequestException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/BadRequestException.java@@ -4,6 +4,7 @@*/package com.datastrato.gravitino.exceptions;+/** An exception thrown when the request is invalid. */public class BadRequestException extends GravitinoRuntimeException {public BadRequestException(String message) {super(message);diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/CatalogAlreadyExistsException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/CatalogAlreadyExistsException.javaindex 5e313e08f9..c7738c6fd4 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/CatalogAlreadyExistsException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/CatalogAlreadyExistsException.java@@ -4,6 +4,7 @@*/package com.datastrato.gravitino.exceptions;+/** An exception thrown when a resource already exists. */public class CatalogAlreadyExistsException extends AlreadyExistsException {public CatalogAlreadyExistsException(String message) {diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/GravitinoRuntimeException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/GravitinoRuntimeException.javaindex 6bb9425eb7..74e10a761b 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/GravitinoRuntimeException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/GravitinoRuntimeException.java@@ -4,6 +4,7 @@*/package com.datastrato.gravitino.exceptions;+/** Base class for all Gravitino runtime exceptions. */public class GravitinoRuntimeException extends RuntimeException {public GravitinoRuntimeException(String message) {diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/IllegalNameIdentifierException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/IllegalNameIdentifierException.javaindex a000f74e8d..fb5b76ccce 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/IllegalNameIdentifierException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/IllegalNameIdentifierException.java@@ -4,6 +4,7 @@*/package com.datastrato.gravitino.exceptions;+/** An exception thrown when a name identifier is invalid. */public class IllegalNameIdentifierException extends IllegalArgumentException {public IllegalNameIdentifierException(String message) {diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/IllegalNamespaceException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/IllegalNamespaceException.javaindex 649691632e..72c2aed37e 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/IllegalNamespaceException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/IllegalNamespaceException.java@@ -4,6 +4,7 @@*/package com.datastrato.gravitino.exceptions;+/** An exception thrown when a namespace is invalid. */public class IllegalNamespaceException extends IllegalArgumentException {public IllegalNamespaceException(String message) {diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/MetalakeAlreadyExistsException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/MetalakeAlreadyExistsException.javaindex 37cde1c0d4..bed8945953 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/MetalakeAlreadyExistsException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/MetalakeAlreadyExistsException.java@@ -4,6 +4,7 @@*/package com.datastrato.gravitino.exceptions;+/** An exception thrown when the metalake already exists. */public class MetalakeAlreadyExistsException extends AlreadyExistsException {public MetalakeAlreadyExistsException(String message) {diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/NoSuchCatalogException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/NoSuchCatalogException.javaindex 78e2dff0d5..dfa11190a5 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/NoSuchCatalogException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/NoSuchCatalogException.java@@ -4,6 +4,7 @@*/package com.datastrato.gravitino.exceptions;+/** An exception thrown when a catalog is not found. */public class NoSuchCatalogException extends NotFoundException {public NoSuchCatalogException(String message) {diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/NoSuchMetalakeException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/NoSuchMetalakeException.javaindex 1da5a8a988..06e6016b11 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/NoSuchMetalakeException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/NoSuchMetalakeException.java@@ -4,6 +4,7 @@*/package com.datastrato.gravitino.exceptions;+/** An exception thrown when a metalake is not found. */public class NoSuchMetalakeException extends NotFoundException {public NoSuchMetalakeException(String message) {diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/NoSuchSchemaException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/NoSuchSchemaException.javaindex 4d6ff78263..738f666cb2 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/NoSuchSchemaException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/NoSuchSchemaException.java@@ -4,6 +4,7 @@*/package com.datastrato.gravitino.exceptions;+/** An exception thrown when a schema is not found. */public class NoSuchSchemaException extends NotFoundException {public NoSuchSchemaException(String message) {diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/NonEmptyEntityException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/NonEmptyEntityException.javaindex 2adbe1a866..cacc9e128a 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/NonEmptyEntityException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/NonEmptyEntityException.java@@ -5,6 +5,7 @@package com.datastrato.gravitino.exceptions;+/** An exception thrown when a resource is not empty. */public class NonEmptyEntityException extends GravitinoRuntimeException {public NonEmptyEntityException(String message) {diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/NotFoundException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/NotFoundException.javaindex e94507428c..748a987cbe 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/NotFoundException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/NotFoundException.java@@ -4,6 +4,7 @@*/package com.datastrato.gravitino.exceptions;+/** Base class for all exceptions thrown when a resource is not found. */public class NotFoundException extends GravitinoRuntimeException {public NotFoundException(String message) {diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/RESTException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/RESTException.javaindex 6708a37dfa..319b29c9c9 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/RESTException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/RESTException.java@@ -22,6 +22,8 @@ import com.google.errorprone.annotations.FormatMethod;// Referred from Apache Iceberg's RESTException implementation// api/src/main/java/org/apache/iceberg/exceptions/RESTException.java++/** An exception thrown when a REST request fails. */public class RESTException extends RuntimeException {@FormatMethodpublic RESTException(String message, Object... args) {diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/SchemaAlreadyExistsException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/SchemaAlreadyExistsException.javaindex 4eaf7f0f7a..17a96814f3 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/SchemaAlreadyExistsException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/SchemaAlreadyExistsException.java@@ -4,6 +4,7 @@*/package com.datastrato.gravitino.exceptions;+/** An exception thrown when the schema already exists. */public class SchemaAlreadyExistsException extends AlreadyExistsException {public SchemaAlreadyExistsException(String message) {diff --git a/api/src/main/java/com/datastrato/gravitino/exceptions/UnauthorizedException.java b/api/src/main/java/com/datastrato/gravitino/exceptions/UnauthorizedException.javaindex 808adbf402..2a4020b2fc 100644--- a/api/src/main/java/com/datastrato/gravitino/exceptions/UnauthorizedException.java+++ b/api/src/main/java/com/datastrato/gravitino/exceptions/UnauthorizedException.java@@ -5,6 +5,7 @@package com.datastrato.gravitino.exceptions;+/** Exception thrown when a user is not authorized to perform an action. */public class UnauthorizedException extends GravitinoRuntimeException {public UnauthorizedException(String message) {diff --git a/api/src/main/java/com/datastrato/gravitino/rel/Column.java b/api/src/main/java/com/datastrato/gravitino/rel/Column.javaindex 8399766fa2..599259f06f 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/Column.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/Column.java@@ -18,16 +18,16 @@ import java.util.Map;*/public interface Column {- /** Returns the name of this column. */+ /** @return The name of this column. */String name();- /** Returns the data type of this column. */+ /** @return The data type of this column. */Type dataType();- /** Returns the comment of this column, null if not specified. */+ /** @return The comment of this column, null if not specified. */String comment();- /** Returns true if this column may produce null values. Default is true. */+ /** @return True if this column may produce null values. Default is true. */boolean nullable();// TODO. Support column default value. @Jerrydiff --git a/api/src/main/java/com/datastrato/gravitino/rel/Schema.java b/api/src/main/java/com/datastrato/gravitino/rel/Schema.javaindex c5aaa91d0a..238c42cc32 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/Schema.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/Schema.java@@ -19,16 +19,16 @@ import javax.annotation.Nullable;*/public interface Schema extends Auditable {- /** Return the name of the Schema. */+ /** @return The name of the Schema. */String name();- /** Return the comment of the Schema. Null is returned if the comment is not set. */+ /** @return The comment of the Schema. Null is returned if the comment is not set. */@Nullabledefault String comment() {return null;}- /** Return the properties of the Schema. An empty map is returned if no properties are set. */+ /** @return The properties of the Schema. An empty map is returned if no properties are set. */default Map<String, String> properties() {return Collections.emptyMap();}diff --git a/api/src/main/java/com/datastrato/gravitino/rel/SchemaChange.java b/api/src/main/java/com/datastrato/gravitino/rel/SchemaChange.javaindex 2f3fe7cbdd..2058dde338 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/SchemaChange.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/SchemaChange.java@@ -23,6 +23,7 @@ package com.datastrato.gravitino.rel;import lombok.EqualsAndHashCode;import lombok.Getter;+/** NamespaceChange class to set the property and value pairs for the namespace. */public interface SchemaChange {/**diff --git a/api/src/main/java/com/datastrato/gravitino/rel/Table.java b/api/src/main/java/com/datastrato/gravitino/rel/Table.javaindex d5c950b9b5..c258c9d6a8 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/Table.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/Table.java@@ -22,38 +22,39 @@ import javax.annotation.Nullable;*/public interface Table extends Auditable {- /** return the name of the table. */+ /** @return Name of the table. */String name();- /** Return the columns of the table. */+ /** @return The columns of the table. */Column[] columns();- /** Returns the physical partitioning of the table. */+ /** @return The physical partitioning of the table. */default Transform[] partitioning() {return EMPTY_TRANSFORM;}/**- * Return the sort order of the table. If no sort order is specified, an empty array is returned.+ * @return The sort order of the table. If no sort order is specified, an empty array is returned.*/default SortOrder[] sortOrder() {return new SortOrder[0];}/**- * Return the bucketing of the table. If no bucketing is specified, Distribution.NONE is returned.+ * @return The bucketing of the table. If no bucketing is specified, Distribution.NONE is+ * returned.*/default Distribution distribution() {return Distributions.NONE;}- /** Return the comment of the table. Null is returned if no comment is set. */+ /** @return The comment of the table. Null is returned if no comment is set. */@Nullabledefault String comment() {return null;}- /** Return the properties of the table. Empty map is returned if no properties are set. */+ /** @return The properties of the table. Empty map is returned if no properties are set. */default Map<String, String> properties() {return Collections.emptyMap();}diff --git a/api/src/main/java/com/datastrato/gravitino/rel/TableCatalog.java b/api/src/main/java/com/datastrato/gravitino/rel/TableCatalog.javaindex a24664e77e..b4231cb93a 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/TableCatalog.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/TableCatalog.java@@ -144,6 +144,7 @@ public interface TableCatalog {* @param columns The columns of the new table.* @param comment The table comment.* @param properties The table properties.+ * @param distribution The distribution of the table.* @return The created table metadata.* @throws NoSuchSchemaException If the schema does not exist.* @throws TableAlreadyExistsException If the table already exists.diff --git a/api/src/main/java/com/datastrato/gravitino/rel/TableChange.java b/api/src/main/java/com/datastrato/gravitino/rel/TableChange.javaindex 2400543dc6..85e24161b0 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/TableChange.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/TableChange.java@@ -26,6 +26,10 @@ import java.util.Objects;import lombok.EqualsAndHashCode;import lombok.Getter;+/**+ * The TableChange interface defines the public API for managing tables in a schema. If the catalog+ * implementation supports tables, it must implement this interface.+ */public interface TableChange {/**@@ -336,6 +340,10 @@ public interface TableChange {}}+ /**+ * The interface for all column positions. Column positions are used to specify the position of a+ * column when adding a new column to a table.+ */interface ColumnPosition {static ColumnPosition first() {@@ -403,6 +411,9 @@ public interface TableChange {}}+ /**+ * The interface for all column changes. Column changes are used to modify the schema of a table.+ */interface ColumnChange extends TableChange {String[] fieldName();}diff --git a/api/src/main/java/com/datastrato/gravitino/rel/expressions/Expression.java b/api/src/main/java/com/datastrato/gravitino/rel/expressions/Expression.javaindex 9997ef8de0..d6028548a2 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/expressions/Expression.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/expressions/Expression.java@@ -33,10 +33,10 @@ public interface Expression {*/NamedReference[] EMPTY_NAMED_REFERENCE = new NamedReference[0];- /** Returns an array of the children of this node. Children should not change. */+ /** @return An array of the children of this node. Children should not change. */Expression[] children();- /** List of fields or columns that are referenced by this expression. */+ /** @return A list of fields or columns that are referenced by this expression. */default NamedReference[] references() {Set<NamedReference> set = new HashSet<>();for (Expression e : children()) {diff --git a/api/src/main/java/com/datastrato/gravitino/rel/expressions/FunctionExpression.java b/api/src/main/java/com/datastrato/gravitino/rel/expressions/FunctionExpression.javaindex c5a8876b61..f78f4074a3 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/expressions/FunctionExpression.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/expressions/FunctionExpression.java@@ -4,6 +4,10 @@*/package com.datastrato.gravitino.rel.expressions;+/**+ * The interface of a function expression. A function expression is an expression that takes a+ * function name and a list of arguments.+ */public interface FunctionExpression extends Expression {/**@@ -27,10 +31,10 @@ public interface FunctionExpression extends Expression {return of(functionName, Expression.EMPTY_EXPRESSION);}- /** Returns the transform function name. */+ /** @return The transform function name. */String functionName();- /** Returns the arguments passed to the transform function. */+ /** @return The arguments passed to the transform function. */Expression[] arguments();@Override@@ -38,6 +42,7 @@ public interface FunctionExpression extends Expression {return arguments();}+ /** A {@link FunctionExpression} implementation */final class FuncExpressionImpl implements FunctionExpression {private final String functionName;private final Expression[] arguments;diff --git a/api/src/main/java/com/datastrato/gravitino/rel/expressions/Literal.java b/api/src/main/java/com/datastrato/gravitino/rel/expressions/Literal.javaindex 2a4a5c773a..70ad8ee478 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/expressions/Literal.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/expressions/Literal.java@@ -30,10 +30,10 @@ import java.util.Objects;* @param <T> the JVM type of value held by the literal*/public interface Literal<T> extends Expression {- /** Returns the literal value. */+ /** @return The literal value. */T value();- /** Returns the data type of the literal. */+ /** @return The data type of the literal. */Type dataType();@Override@@ -73,6 +73,11 @@ public interface Literal<T> extends Expression {return of(value, Types.StringType.get());}+ /**+ * Creates a literal with the given type value.+ *+ * @param <T> The JVM type of value held by the literal.+ */final class LiteralImpl<T> implements Literal<T> {private final T value;private final Type dataType;diff --git a/api/src/main/java/com/datastrato/gravitino/rel/expressions/NamedReference.java b/api/src/main/java/com/datastrato/gravitino/rel/expressions/NamedReference.javaindex 81ae0a5550..dc6d62d643 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/expressions/NamedReference.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/expressions/NamedReference.java@@ -52,6 +52,8 @@ public interface NamedReference extends Expression {* Returns the referenced field name as an array of String parts.** <p>Each string in the returned array represents a field name.+ *+ * @return the referenced field name as an array of String parts.*/String[] fieldName();@@ -65,6 +67,7 @@ public interface NamedReference extends Expression {return new NamedReference[] {this};}+ /** A {@link NamedReference} that references a field or column. */final class FieldReference implements NamedReference {private final String[] fieldName;diff --git a/api/src/main/java/com/datastrato/gravitino/rel/expressions/distributions/Distribution.java b/api/src/main/java/com/datastrato/gravitino/rel/expressions/distributions/Distribution.javaindex 66a3eff367..99089730ef 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/expressions/distributions/Distribution.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/expressions/distributions/Distribution.java@@ -8,16 +8,16 @@ import com.datastrato.gravitino.rel.expressions.Expression;/** An interface that defines how data is distributed across partitions. */public interface Distribution extends Expression {- /** Returns the distribution strategy name. */+ /** @return the distribution strategy name. */Strategy strategy();/**- * Returns the number of buckets/distribution. For example, if the distribution strategy is HASH- * and the number is 10, then the data is distributed across 10 buckets.+ * @return The number of buckets/distribution. For example, if the distribution strategy is HASH+ * and the number is 10, then the data is distributed across 10 buckets.*/int number();- /** Returns the expressions passed to the distribution function. */+ /** @return The expressions passed to the distribution function. */Expression[] expressions();@Overridediff --git a/api/src/main/java/com/datastrato/gravitino/rel/expressions/distributions/Distributions.java b/api/src/main/java/com/datastrato/gravitino/rel/expressions/distributions/Distributions.javaindex c843fc8bab..a747e3a2f4 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/expressions/distributions/Distributions.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/expressions/distributions/Distributions.java@@ -66,6 +66,11 @@ public class Distributions {* SQL syntax: distribute by EVEN(a) buckets 128* fields(Strategy.EVEN, 128, new String[]{"a"});* </pre>+ *+ * @param strategy The strategy to use.+ * @param number The number of buckets.+ * @param fieldNames The field names to distribute by.+ * @return The created distribution.*/public static Distribution fields(Strategy strategy, int number, String[]... fieldNames) {Expression[] expressions =@@ -73,6 +78,10 @@ public class Distributions {return of(strategy, number, expressions);}+ /**+ * Create a distribution on columns. Like distribute by (a) or (a, b), for complex like+ * distributing by (func(a), b) or (func(a), func(b)), please use {@link DistributionImpl.Builder}+ */public static final class DistributionImpl implements Distribution {private final Strategy strategy;private final int number;@@ -99,6 +108,7 @@ public class Distributions {return expressions;}+ /** Builder to create a distribution. */public static class Builder {private Strategy strategy;private int number;diff --git a/api/src/main/java/com/datastrato/gravitino/rel/expressions/sorts/SortDirection.java b/api/src/main/java/com/datastrato/gravitino/rel/expressions/sorts/SortDirection.javaindex 7e069d6283..be6063317e 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/expressions/sorts/SortDirection.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/expressions/sorts/SortDirection.java@@ -38,7 +38,11 @@ public enum SortDirection {this.defaultNullOrdering = defaultNullOrdering;}- /** Returns the default null ordering to use if no null ordering is specified explicitly. */+ /**+ * Returns the default null ordering to use if no null ordering is specified explicitly.+ *+ * @return The default null ordering.+ */public NullOrdering defaultNullOrdering() {return defaultNullOrdering;}diff --git a/api/src/main/java/com/datastrato/gravitino/rel/expressions/sorts/SortOrder.java b/api/src/main/java/com/datastrato/gravitino/rel/expressions/sorts/SortOrder.javaindex 75983a20f8..cf4d94c669 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/expressions/sorts/SortOrder.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/expressions/sorts/SortOrder.java@@ -24,15 +24,16 @@ import com.datastrato.gravitino.rel.expressions.Expression;/** Represents a sort order in the public expression API. */public interface SortOrder extends Expression {- /** Returns the sort expression. */+ /** @return The sort expression. */Expression expression();- /** Returns the sort direction. */+ /** @return The sort direction. */SortDirection direction();- /** Returns the null ordering. */+ /** @return The null ordering. */NullOrdering nullOrdering();+ /** @return A {@link SortOrder} with the given sort direction. */@Overridedefault Expression[] children() {return new Expression[] {expression()};diff --git a/api/src/main/java/com/datastrato/gravitino/rel/expressions/sorts/SortOrders.java b/api/src/main/java/com/datastrato/gravitino/rel/expressions/sorts/SortOrders.javaindex 15ba0823b9..ad42a89c7d 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/expressions/sorts/SortOrders.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/expressions/sorts/SortOrders.java@@ -56,6 +56,9 @@ public class SortOrders {return new SortImpl(expression, direction, nullOrdering);}+ /**+ * Create a sort order by the given expression with the given sort direction and null ordering.+ */public static final class SortImpl implements SortOrder {private final Expression expression;private final SortDirection direction;diff --git a/api/src/main/java/com/datastrato/gravitino/rel/expressions/transforms/Transform.java b/api/src/main/java/com/datastrato/gravitino/rel/expressions/transforms/Transform.javaindex 849f50845c..953ac5b918 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/expressions/transforms/Transform.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/expressions/transforms/Transform.java@@ -31,15 +31,15 @@ import java.util.Objects;* The transform name is "date" and its argument is a reference to the "ts" column.*/public interface Transform extends Expression {- /** Returns the transform function name. */+ /** @return The transform function name. */String name();- /** Returns the arguments passed to the transform function. */+ /** @return The arguments passed to the transform function. */Expression[] arguments();/**- * Returns the preassigned partitions in the partitioning. Currently, only ListTransform and- * RangeTransform need to deal with assignments+ * @return The preassigned partitions in the partitioning. Currently, only ListTransform and+ * RangeTransform need to deal with assignments*/default Expression[] assignments() {return Expression.EMPTY_EXPRESSION;diff --git a/api/src/main/java/com/datastrato/gravitino/rel/expressions/transforms/Transforms.java b/api/src/main/java/com/datastrato/gravitino/rel/expressions/transforms/Transforms.javaindex 6bb93e888f..0b7f581f9d 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/expressions/transforms/Transforms.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/expressions/transforms/Transforms.java@@ -211,6 +211,7 @@ public class Transforms {return new HourTransform(ref);}+ /** A transform that returns the input value. */public static final class IdentityTransform extends Transform.SingleFieldTransform {private IdentityTransform(NamedReference ref) {this.ref = ref;@@ -232,6 +233,7 @@ public class Transforms {}}+ /** A transform that returns the year of the input value. */public static final class YearTransform extends Transform.SingleFieldTransform {private YearTransform(NamedReference ref) {this.ref = ref;@@ -253,6 +255,7 @@ public class Transforms {}}+ /** A transform that returns the month of the input value. */public static final class MonthTransform extends Transform.SingleFieldTransform {private MonthTransform(NamedReference ref) {this.ref = ref;@@ -274,6 +277,7 @@ public class Transforms {}}+ /** A transform that returns the day of the input value. */public static final class DayTransform extends Transform.SingleFieldTransform {private DayTransform(NamedReference ref) {this.ref = ref;@@ -295,6 +299,7 @@ public class Transforms {}}+ /** A transform that returns the hour of the input value. */public static final class HourTransform extends Transform.SingleFieldTransform {private HourTransform(NamedReference ref) {this.ref = ref;@@ -316,6 +321,7 @@ public class Transforms {}}+ /** A transform that returns the bucket of the input value. */public static final class BucketTransform implements Transform {private final Literal<Integer> numBuckets;@@ -364,6 +370,7 @@ public class Transforms {}}+ /** A transform that returns the truncated value of the input value with the given width. */public static final class TruncateTransform implements Transform {private final Literal<Integer> width;@@ -410,6 +417,7 @@ public class Transforms {}}+ /** A transform that includes multiple fields in a list. */public static final class ListTransform implements Transform {private final NamedReference[] fields;@@ -456,6 +464,7 @@ public class Transforms {}}+ /** A transform that returns the range of the input value. */public static final class RangeTransform implements Transform {private final NamedReference field;@@ -498,6 +507,7 @@ public class Transforms {}}+ /** A transform that applies a function to the input value. */public static final class ApplyTransform implements Transform {private final String name;diff --git a/api/src/main/java/com/datastrato/gravitino/rel/types/Type.java b/api/src/main/java/com/datastrato/gravitino/rel/types/Type.javaindex a5396805ef..6c319b181b 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/types/Type.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/types/Type.java@@ -6,12 +6,13 @@ package com.datastrato.gravitino.rel.types;/** An interface representing all data types supported by Gravitino. */public interface Type {- /** Returns the generic name of the type. */+ /** @return The generic name of the type. */Name name();- /** Readable string representation for the type. */+ /** @return A readable string representation for the type. */String simpleString();+ /** The root type name of this type. */enum Name {BOOLEAN,BYTE,diff --git a/api/src/main/java/com/datastrato/gravitino/rel/types/Types.java b/api/src/main/java/com/datastrato/gravitino/rel/types/Types.javaindex 766690f75b..186385abf3 100644--- a/api/src/main/java/com/datastrato/gravitino/rel/types/Types.java+++ b/api/src/main/java/com/datastrato/gravitino/rel/types/Types.java@@ -12,10 +12,11 @@ import java.util.StringJoiner;/** The helper class for {@link Type}. */public class Types {+ /** The boolean type in Gravitino. */public static class BooleanType extends Type.PrimitiveType {private static final BooleanType INSTANCE = new BooleanType();- /** Returns the singleton instance of {@link BooleanType}. */+ /** @return The singleton instance of {@link BooleanType}. */public static BooleanType get() {return INSTANCE;}@@ -33,10 +34,11 @@ public class Types {}}+ /** The byte type in Gravitino. */public static class ByteType extends Type.IntegralType {private static final ByteType INSTANCE = new ByteType();- /** Returns the singleton instance of {@link ByteType}. */+ /** @return The singleton instance of {@link ByteType}. */public static ByteType get() {return INSTANCE;}@@ -54,10 +56,11 @@ public class Types {}}+ /** The short type in Gravitino. */public static class ShortType extends Type.IntegralType {private static final ShortType INSTANCE = new ShortType();- /** Returns the singleton instance of {@link ShortType}. */+ /** @return The singleton instance of {@link ShortType}. */public static ShortType get() {return INSTANCE;}@@ -75,10 +78,11 @@ public class Types {}}+ /** The integer type in Gravitino. */public static class IntegerType extends Type.IntegralType {private static final IntegerType INSTANCE = new IntegerType();- /** Returns the singleton instance of {@link IntegerType}. */+ /** @return The singleton instance of {@link IntegerType}. */public static IntegerType get() {return INSTANCE;}@@ -96,10 +100,11 @@ public class Types {}}+ /** The long type in Gravitino. */public static class LongType extends Type.IntegralType {private static final LongType INSTANCE = new LongType();- /** Returns the singleton instance of {@link LongType}. */+ /** @return The singleton instance of {@link LongType}. */public static LongType get() {return INSTANCE;}@@ -117,10 +122,11 @@ public class Types {}}+ /** The float type in Gravitino. */public static class FloatType extends Type.FractionType {private static final FloatType INSTANCE = new FloatType();- /** Returns the singleton instance of {@link FloatType}. */+ /** @return The singleton instance of {@link FloatType}. */public static FloatType get() {return INSTANCE;}@@ -138,10 +144,11 @@ public class Types {}}+ /** The double type in Gravitino. */public static class DoubleType extends Type.FractionType {private static final DoubleType INSTANCE = new DoubleType();- /** Returns the singleton instance of {@link DoubleType}. */+ /** @return The singleton instance of {@link DoubleType}. */public static DoubleType get() {return INSTANCE;}@@ -159,8 +166,13 @@ public class Types {}}+ /** The decimal type in Gravitino. */public static class DecimalType extends Type.FractionType {- /** Returns a {@link DecimalType} with the given precision and scale. */+ /**+ * @param precision The precision of the decimal type.+ * @param scale The scale of the decimal type.+ * @return A {@link DecimalType} with the given precision and scale.+ */public static DecimalType of(int precision, int scale) {return new DecimalType(precision, scale);}@@ -215,10 +227,11 @@ public class Types {}}+ /** The date time type in Gravitino. */public static class DateType extends Type.DateTimeType {private static final DateType INSTANCE = new DateType();- /** Returns the singleton instance of {@link DateType}. */+ /** @return The singleton instance of {@link DateType}. */public static DateType get() {return INSTANCE;}@@ -236,10 +249,11 @@ public class Types {}}+ /** The time type in Gravitino. */public static class TimeType extends Type.DateTimeType {private static final TimeType INSTANCE = new TimeType();- /** Returns the singleton instance of {@link TimeType}. */+ /** @return The singleton instance of {@link TimeType}. */public static TimeType get() {return INSTANCE;}@@ -257,16 +271,17 @@ public class Types {}}+ /** The timestamp type in Gravitino. */public static class TimestampType extends Type.DateTimeType {private static final TimestampType INSTANCE_WITHOUT_TIME_ZONE = new TimestampType(false);private static final TimestampType INSTANCE_WITH_TIME_ZONE = new TimestampType(true);- /** Returns a {@link TimestampType} with time zone. */+ /** @return A {@link TimestampType} with time zone. */public static TimestampType withTimeZone() {return INSTANCE_WITH_TIME_ZONE;}- /** Returns a {@link TimestampType} without time zone. */+ /** @return A {@link TimestampType} without time zone. */public static TimestampType withoutTimeZone() {return INSTANCE_WITHOUT_TIME_ZONE;}@@ -292,10 +307,11 @@ public class Types {}}+ /** The interval year type in Gravitino. */public static class IntervalYearType extends Type.IntervalType {private static final IntervalYearType INSTANCE = new IntervalYearType();- /** Returns the singleton instance of {@link IntervalYearType}. */+ /** @return The singleton instance of {@link IntervalYearType}. */public static IntervalYearType get() {return INSTANCE;}@@ -313,10 +329,11 @@ public class Types {}}+ /** The interval day type in Gravitino. */public static class IntervalDayType extends Type.IntervalType {private static final IntervalDayType INSTANCE = new IntervalDayType();- /** Returns the singleton instance of {@link IntervalDayType}. */+ /** @return The singleton instance of {@link IntervalDayType}. */public static IntervalDayType get() {return INSTANCE;}@@ -334,10 +351,11 @@ public class Types {}}+ /** The string type in Gravitino. */public static class StringType extends Type.PrimitiveType {private static final StringType INSTANCE = new StringType();- /** Returns the singleton instance of {@link StringType}. */+ /** @return The singleton instance of {@link StringType}. */public static StringType get() {return INSTANCE;}@@ -355,10 +373,11 @@ public class Types {}}+ /** The uuid type in Gravitino. */public static class UUIDType extends Type.PrimitiveType {private static final UUIDType INSTANCE = new UUIDType();- /** Returns the singleton instance of {@link UUIDType}. */+ /** @return The singleton instance of {@link UUIDType}. */public static UUIDType get() {return INSTANCE;}@@ -376,9 +395,13 @@ public class Types {}}+ /** The fixed string type in Gravitino. */public static class FixedType extends Type.PrimitiveType {- /** Returns a {@link FixedType} with the given length. */+ /**+ * @param length The length of the fixed type.+ * @return An {@link FixedType} with the given length.+ */public static FixedType of(int length) {return new FixedType(length);}@@ -421,9 +444,13 @@ public class Types {}}+ /** The varchar type in Gravitino. */public static class VarCharType extends Type.PrimitiveType {- /** Returns a {@link VarCharType} with the given length. */+ /**+ * @param length The length of the var char type.+ * @return An {@link VarCharType} with the given length.+ */public static VarCharType of(int length) {return new VarCharType(length);}@@ -466,9 +493,13 @@ public class Types {}}+ /** The fixed char type in Gravitino. */public static class FixedCharType extends Type.PrimitiveType {- /** Returns a {@link FixedCharType} with the given length. */+ /**+ * @param length The length of the fixed char type.+ * @return An {@link FixedCharType} with the given length.+ */public static FixedCharType of(int length) {return new FixedCharType(length);}@@ -511,10 +542,14 @@ public class Types {}}+ /**+ * The binary type in Gravitino. Note, this type is not supported in the current version of+ * Gravitino.+ */public static class BinaryType extends Type.PrimitiveType {private static final BinaryType INSTANCE = new BinaryType();- /** Returns the singleton instance of {@link BinaryType}. */+ /** @return The singleton instance of {@link BinaryType}. */public static BinaryType get() {return INSTANCE;}@@ -532,9 +567,16 @@ public class Types {}}+ /**+ * The struct type in Gravitino. Note, this type is not supported in the current version of+ * Gravitino.+ */public static class StructType extends Type.ComplexType {- /** Returns a {@link StructType} with the given fields. */+ /**+ * @param fields The fields of the struct type.+ * @return An {@link StructType} with the given fields.+ */public static StructType of(Field... fields) {Preconditions.checkArgument(fields != null && fields.length > 0, "fields cannot be null or empty");@@ -580,29 +622,54 @@ public class Types {return Arrays.hashCode(fields);}+ /** A field of a struct type. */public static class Field {- /** Returns a NOT NULL {@link Field} with the given name, type and empty comment. */+ /**+ * @param name The name of the field.+ * @param type The type of the field.+ * @return A NOT NULL {@link Field} with the given name, type and empty comment.+ */public static Field notNullField(String name, Type type) {return notNullField(name, type, null);}- /** Returns a NOT NULL {@link Field} with the given name, type and comment. */+ /**+ * @param name The name of the field.+ * @param type The type of the field.+ * @param comment The comment of the field.+ * @return A NOT NULL {@link Field} with the given name, type and comment.+ */public static Field notNullField(String name, Type type, String comment) {return of(name, type, false, comment);}- /** Returns a nullable {@link Field} with the given name, type and empty comment. */+ /**+ * @param name The name of the field.+ * @param type The type of the field.+ * @return A nullable {@link Field} with the given name, type and empty comment.+ */public static Field nullableField(String name, Type type) {return nullableField(name, type, null);}- /** Returns a nullable {@link Field} with the given name, type and comment. */+ /**+ * @param name The name of the field.+ * @param type The type of the field.+ * @param comment The comment of the field.+ * @return A nullable {@link Field} with the given name, type and comment.+ */public static Field nullableField(String name, Type type, String comment) {return of(name, type, true, comment);}- /** Returns a nullable {@link Field} with the given name, type and comment. */+ /**+ * @param name The name of the field.+ * @param type The type of the field.+ * @param nullable Whether the field is nullable.+ * @param comment The comment of the field.+ * @return A nullable {@link Field} with the given name, type and comment.+ */public static Field of(String name, Type type, boolean nullable, String comment) {return new Field(name, type, nullable, comment);}@@ -621,22 +688,22 @@ public class Types {this.comment = comment;}- /** Returns the name of the field. */+ /** @return The name of the field. */public String name() {return name;}- /** Returns the type of the field. */+ /** @return The type of the field. */public Type type() {return type;}- /** Returns whether the field is nullable. */+ /** @return Whether the field is nullable. */public boolean nullable() {return nullable;}- /** Returns the comment of the field. May be null if not set. */+ /** @return The comment of the field. May be null if not set. */public String comment() {return comment;}@@ -671,6 +738,7 @@ public class Types {}}+ /** A list type. Note, this type is not supported in the current version of Gravitino. */public static class ListType extends Type.ComplexType {public static ListType nullable(Type elementType) {@@ -733,6 +801,10 @@ public class Types {}}+ /**+ * The map type in Gravitino. Note, this type is not supported in the current version of+ * Gravitino.+ */public static class MapType extends Type.ComplexType {public static MapType valueNullable(Type keyType, Type valueType) {@@ -799,6 +871,10 @@ public class Types {}}+ /**+ * The union type in Gravitino. Note, this type is not supported in the current version of+ * Gravitino.+ */public static class UnionType extends Type.ComplexType {public static UnionType of(Type... types) {diff --git a/build.gradle.kts b/build.gradle.ktsindex c58f6e9746..40bf3ce9e1 100644--- a/build.gradle.kts+++ b/build.gradle.kts@@ -140,6 +140,11 @@ subprojects {}}+ tasks.withType<Javadoc> {+ options.encoding = "UTF-8"+ options.locale = "en_US"+ }+val sourcesJar by tasks.registering(Jar::class) {from(sourceSets.named("main").get().allSource)archiveClassifier.set("sources")diff --git a/clients/client-java/build.gradle.kts b/clients/client-java/build.gradle.ktsindex a43950d7b2..baaf862bb2 100644--- a/clients/client-java/build.gradle.kts+++ b/clients/client-java/build.gradle.kts@@ -37,3 +37,7 @@ dependencies {testImplementation(libs.mockserver.client.java)testImplementation(libs.bundles.jwt)}++tasks.build {+ dependsOn("javadoc")+}diff --git a/core/src/main/java/com/datastrato/gravitino/EntityStore.java b/core/src/main/java/com/datastrato/gravitino/EntityStore.javaindex c747615fa4..eeac95f704 100644--- a/core/src/main/java/com/datastrato/gravitino/EntityStore.java+++ b/core/src/main/java/com/datastrato/gravitino/EntityStore.java@@ -42,9 +42,11 @@ public interface EntityStore extends Closeable {* may not be consistent.** @param namespace the namespace of the entities- * @return the list of entities- * @param type the type of the entity+ * @param <E> class of the entity+ * @param type the detailed type of the entity+ * @param entityType the general type of the entity* @throws IOException if the list operation fails+ * @return the list of entities*/<E extends Entity & HasIdentifier> List<E> list(Namespace namespace, Class<E> type, EntityType entityType) throws IOException;@@ -53,6 +55,7 @@ public interface EntityStore extends Closeable {* Check if the entity with the specified {@link NameIdentifier} exists.** @param ident the name identifier of the entity+ * @param entityType the general type of the entity,* @return true if the entity exists, false otherwise* @throws IOException if the check operation fails*/@@ -100,9 +103,10 @@ public interface EntityStore extends Closeable {* <p>Note: the whole update operation should be in one transaction.** @param ident the name identifier of the entity- * @param type the type of the entity+ * @param type the detailed type of the entity* @param updater the updater function to update the entity- * @param <E> the type of the entity+ * @param <E> the class of the entity+ * @param entityType the general type of the entity* @return E the updated entity* @throws IOException if the store operation fails* @throws NoSuchEntityException if the entity does not exist@@ -119,6 +123,9 @@ public interface EntityStore extends Closeable {* retrieve of entities.** @param ident the unique identifier of the entity+ * @param entityType the general type of the entity+ * @param e the entity class instance+ * @param <E> the class of entity* @return the entity retrieved from the underlying storage* @throws NoSuchEntityException if the entity does not exist* @throws IOException if the retrieve operation fails@@ -154,8 +161,10 @@ public interface EntityStore extends Closeable {** @param executable the executable to run* @param <R> the type of the return value+ * @param <E> the type of the exception* @return the return value of the executable* @throws IOException if the execution fails+ * @throws E if the execution fails*/<R, E extends Exception> R executeInTransaction(Executable<R, E> executable)throws E, IOException;diff --git a/core/src/main/java/com/datastrato/gravitino/StringIdentifier.java b/core/src/main/java/com/datastrato/gravitino/StringIdentifier.javaindex 64825a8893..718e5dc7cd 100644--- a/core/src/main/java/com/datastrato/gravitino/StringIdentifier.java+++ b/core/src/main/java/com/datastrato/gravitino/StringIdentifier.java@@ -80,7 +80,13 @@ public class StringIdentifier {return String.format(CURRENT_FORMAT, CURRENT_FORMAT_VERSION, id);}- /** ******Helper methods to set/get StringIdentifier to/from different places******* */+ /**+ * Helper methods to set/get StringIdentifier to/from different places+ *+ * @param stringId the string identifier to add to the properties+ * @param properties the properties to add the string identifier to+ * @return the properties with the string identifier added+ */public static Map<String, String> addToProperties(StringIdentifier stringId, Map<String, String> properties) {if (properties == null) {diff --git a/core/src/main/java/com/datastrato/gravitino/aux/GravitinoAuxiliaryService.java b/core/src/main/java/com/datastrato/gravitino/aux/GravitinoAuxiliaryService.javaindex c667518f71..5f5a71b8aa 100644--- a/core/src/main/java/com/datastrato/gravitino/aux/GravitinoAuxiliaryService.java+++ b/core/src/main/java/com/datastrato/gravitino/aux/GravitinoAuxiliaryService.java@@ -16,6 +16,8 @@ public interface GravitinoAuxiliaryService {/*** The name of GravitinoAuxiliaryService implementation, GravitinoServer will automatically start* the aux service implementation if the name is added to `gravitino.auxService.AuxServiceNames`+ *+ * @return the name of GravitinoAuxiliaryService implementation*/String shortName();@@ -28,6 +30,10 @@ public interface GravitinoAuxiliaryService {/** Start aux service */void serviceStart();- /** Stop aux service */+ /**+ * Stop aux service+ *+ * @throws Exception if the stop operation fails+ */void serviceStop() throws Exception;}diff --git a/core/src/main/java/com/datastrato/gravitino/catalog/rel/BaseTable.java b/core/src/main/java/com/datastrato/gravitino/catalog/rel/BaseTable.javaindex 68cdd2f363..98ffa83552 100644--- a/core/src/main/java/com/datastrato/gravitino/catalog/rel/BaseTable.java+++ b/core/src/main/java/com/datastrato/gravitino/catalog/rel/BaseTable.java@@ -80,7 +80,7 @@ public abstract class BaseTable implements Table {/*** Returns the distribution strategy of the table.*- * @return+ * @return The distribution strategy of the table.*/@Overridepublic Distribution distribution() {diff --git a/core/src/main/java/com/datastrato/gravitino/storage/EntityKeyEncoder.java b/core/src/main/java/com/datastrato/gravitino/storage/EntityKeyEncoder.javaindex cf92c03d65..b2db697a54 100644--- a/core/src/main/java/com/datastrato/gravitino/storage/EntityKeyEncoder.java+++ b/core/src/main/java/com/datastrato/gravitino/storage/EntityKeyEncoder.java@@ -27,6 +27,8 @@ public interface EntityKeyEncoder<T> {* Construct the key for key-value store from the entity NameIdentifier and EntityType.** @param nullIfMissing return null if the specific entity no found+ * @param type type of the ident that represents+ * @param ident entity identifier to encode* @return encoded key for key-value stored* @throws IOException Exception if error occurs*/diff --git a/core/src/main/java/com/datastrato/gravitino/storage/IdGenerator.java b/core/src/main/java/com/datastrato/gravitino/storage/IdGenerator.javaindex 9bebc78110..8f03534e92 100644--- a/core/src/main/java/com/datastrato/gravitino/storage/IdGenerator.java+++ b/core/src/main/java/com/datastrato/gravitino/storage/IdGenerator.java@@ -8,6 +8,10 @@ package com.datastrato.gravitino.storage;/** Generate a unique id that maps to a name. */public interface IdGenerator {- /** Returns a unique identifier. */+ /**+ * Returns a unique identifier.+ *+ * @return Next id to be used.+ */long nextId();}diff --git a/core/src/main/java/com/datastrato/gravitino/storage/TransactionIdGenerator.java b/core/src/main/java/com/datastrato/gravitino/storage/TransactionIdGenerator.javaindex b6712e876a..786fb3de75 100644--- a/core/src/main/java/com/datastrato/gravitino/storage/TransactionIdGenerator.java+++ b/core/src/main/java/com/datastrato/gravitino/storage/TransactionIdGenerator.java@@ -13,6 +13,8 @@ public interface TransactionIdGenerator extends Closeable {/*** Next transaction id. The transaction id is a monotonically increasing number, which is used as* MVCC version.+ *+ * @return next transaction id*/long nextId();diff --git a/core/src/main/java/com/datastrato/gravitino/storage/kv/KvEntityStore.java b/core/src/main/java/com/datastrato/gravitino/storage/kv/KvEntityStore.javaindex cb97c407d9..70c64f314e 100644--- a/core/src/main/java/com/datastrato/gravitino/storage/kv/KvEntityStore.java+++ b/core/src/main/java/com/datastrato/gravitino/storage/kv/KvEntityStore.java@@ -254,6 +254,7 @@ public class KvEntityStore implements EntityStore {** @param nameIdentifier name of a specific entity* @return key that maps to the id of a specific entity. See above, The key maybe like '4/5/c1'+ * @throws IOException if error occurs*/public String generateKeyForMapping(NameIdentifier nameIdentifier) throws IOException {if (nameIdentifier.namespace().isEmpty()) {diff --git a/core/src/main/java/com/datastrato/gravitino/storage/kv/TransactionalKvBackend.java b/core/src/main/java/com/datastrato/gravitino/storage/kv/TransactionalKvBackend.javaindex a61d0b62d5..84dc8c48b1 100644--- a/core/src/main/java/com/datastrato/gravitino/storage/kv/TransactionalKvBackend.java+++ b/core/src/main/java/com/datastrato/gravitino/storage/kv/TransactionalKvBackend.java@@ -12,10 +12,18 @@ public interface TransactionalKvBackend extends KvBackend {/** Begin the transaction. */void begin();- /** Commit the transaction. */+ /**+ * Commit the transaction.+ *+ * @throws IOException if the commit operation fails+ */void commit() throws IOException;- /** Rollback the transaction if something goes wrong. */+ /**+ * Rollback the transaction if something goes wrong.+ *+ * @throws IOException if the rollback operation fails+ */void rollback() throws IOException;/** Close the current transaction. */diff --git a/core/src/main/java/com/datastrato/gravitino/storage/kv/TransactionalKvBackendImpl.java b/core/src/main/java/com/datastrato/gravitino/storage/kv/TransactionalKvBackendImpl.javaindex c263c23933..69caf3d033 100644--- a/core/src/main/java/com/datastrato/gravitino/storage/kv/TransactionalKvBackendImpl.java+++ b/core/src/main/java/com/datastrato/gravitino/storage/kv/TransactionalKvBackendImpl.java@@ -29,8 +29,8 @@ import org.apache.commons.lang3.tuple.Pair;** <pre>* KEY VALUE- * key1 + separator + 1 --> status_code + v1- * tx + separator + 1 --> binary that contains all keys involved in this tx+ * key1 + separator + 1 -- status_code + v1+ * tx + separator + 1 -- binary that contains all keys involved in this tx* </pre>** We use '0x1F' as the separator, '______tx' as the value of tx, key1 + separator + 1 as the key ofdiff --git a/core/src/main/java/com/datastrato/gravitino/utils/IsolatedClassLoader.java b/core/src/main/java/com/datastrato/gravitino/utils/IsolatedClassLoader.javaindex ef3167d5b9..4359b9a362 100644--- a/core/src/main/java/com/datastrato/gravitino/utils/IsolatedClassLoader.java+++ b/core/src/main/java/com/datastrato/gravitino/utils/IsolatedClassLoader.java@@ -75,6 +75,12 @@ public class IsolatedClassLoader implements Closeable {/*** Executes the provided function within the isolated class loading context and wraps any* exception, for more, please refer to {@link #withClassLoader(ThrowableFunction)}.+ *+ * @param fn The function to be executed within the isolated class loading context.+ * @param exceptionClass The exception class to be wrapped.+ * @param <E> The exception type.+ * @param <T> The type of value return by this method+ * @return The return value of the fn that executed within the classloader.*/public <T, E extends RuntimeException> T withClassLoader(ThrowableFunction<ClassLoader, T> fn, Class<E> exceptionClass) {