This is an automated email from the ASF dual-hosted git repository.
yuqi4733 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new ad35e8ad6 [#3731] docs(API): Update the tutorial and document for the
Java client API change (#3742)
ad35e8ad6 is described below
commit ad35e8ad64895f64e5f5d6c272212941d202d1f4
Author: Shaofeng Shi <[email protected]>
AuthorDate: Mon Jul 8 10:49:04 2024 +0800
[#3731] docs(API): Update the tutorial and document for the Java client API
change (#3742)
### What changes were proposed in this pull request?
Update the documentations for the latest Java API change
### Why are the changes needed?
To make the document sync with API change.
Fix: #3731
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Document, local previewd.
---
.../gravitino/client/FilesetCatalog.java | 29 +++++----
.../gravitino/client/MessagingCatalog.java | 26 +++++---
.../gravitino/client/RelationalCatalog.java | 20 +++---
.../gravitino/catalog/fileset_catalog.py | 8 +--
docs/manage-fileset-metadata-using-gravitino.md | 46 +++++++------
docs/manage-messaging-metadata-using-gravitino.md | 19 +++---
docs/manage-metalake-using-gravitino.md | 12 ++--
docs/manage-relational-metadata-using-gravitino.md | 76 +++++++++++-----------
docs/manage-table-partition-using-gravitino.md | 20 +++---
...le-partitioning-bucketing-sort-order-indexes.md | 4 +-
10 files changed, 132 insertions(+), 128 deletions(-)
diff --git
a/clients/client-java/src/main/java/com/datastrato/gravitino/client/FilesetCatalog.java
b/clients/client-java/src/main/java/com/datastrato/gravitino/client/FilesetCatalog.java
index 06e6e9d40..5e0a6916c 100644
---
a/clients/client-java/src/main/java/com/datastrato/gravitino/client/FilesetCatalog.java
+++
b/clients/client-java/src/main/java/com/datastrato/gravitino/client/FilesetCatalog.java
@@ -97,10 +97,9 @@ public class FilesetCatalog extends BaseSchemaCatalog
}
/**
- * Load fileset metadata by {@link NameIdentifier} from the catalog, which
should be a
- * "schema.fileset" style.
+ * Load fileset metadata by {@link NameIdentifier} from the catalog.
*
- * @param ident A fileset identifier.
+ * @param ident A fileset identifier, which should be "schema.fileset"
format.
* @return The fileset metadata.
* @throws NoSuchFilesetException If the fileset does not exist.
*/
@@ -128,7 +127,7 @@ public class FilesetCatalog extends BaseSchemaCatalog
*
* <p>If the type of the fileset object is "EXTERNAL", the underlying
storageLocation must be set.
*
- * @param ident A fileset identifier, which should be a "schema.fileset"
style.
+ * @param ident A fileset identifier, which should be "schema.fileset"
format.
* @param comment The comment of the fileset.
* @param type The type of the fileset.
* @param storageLocation The storage location of the fileset.
@@ -172,7 +171,7 @@ public class FilesetCatalog extends BaseSchemaCatalog
/**
* Update a fileset metadata in the catalog.
*
- * @param ident A fileset identifier, which should be a "schema.fileset"
style.
+ * @param ident A fileset identifier, which should be "schema.fileset"
format.
* @param changes The changes to apply to the fileset.
* @return The updated fileset metadata.
* @throws NoSuchFilesetException If the fileset does not exist.
@@ -209,7 +208,7 @@ public class FilesetCatalog extends BaseSchemaCatalog
* <p>The underlying files will be deleted if this fileset type is managed,
otherwise, only the
* metadata will be dropped.
*
- * @param ident A fileset identifier, which should be a "schema.fileset"
style.
+ * @param ident A fileset identifier, which should be "schema.fileset"
format.
* @return true If the fileset is dropped, false the fileset did not exist.
*/
@Override
@@ -240,9 +239,9 @@ public class FilesetCatalog extends BaseSchemaCatalog
}
/**
- * Check whether the namespace of a fileset is valid
+ * Check whether the namespace of a fileset is valid.
*
- * @param namespace The namespace to check
+ * @param namespace The namespace to check.
*/
static void checkFilesetNamespace(Namespace namespace) {
Namespace.check(
@@ -252,9 +251,9 @@ public class FilesetCatalog extends BaseSchemaCatalog
}
/**
- * Check whether the NameIdentifier of a fileset is valid
+ * Check whether the NameIdentifier of a fileset is valid.
*
- * @param ident The NameIdentifier to check
+ * @param ident The NameIdentifier to check, which should be
"schema.fileset" format.
*/
static void checkFilesetNameIdentifier(NameIdentifier ident) {
NameIdentifier.check(ident != null, "NameIdentifier must not be null");
@@ -263,8 +262,14 @@ public class FilesetCatalog extends BaseSchemaCatalog
checkFilesetNamespace(ident.namespace());
}
- private Namespace getFilesetFullNamespace(Namespace tableNamespace) {
- return Namespace.of(this.catalogNamespace().level(0), this.name(),
tableNamespace.level(0));
+ /**
+ * Get the full namespace of the fileset with the given fileset's short
namespace (schema name).
+ *
+ * @param filesetNamespace The fileset's short namespace, which is the
schema name.
+ * @return full namespace of the fileset, which is "metalake.catalog.schema"
format.
+ */
+ private Namespace getFilesetFullNamespace(Namespace filesetNamespace) {
+ return Namespace.of(this.catalogNamespace().level(0), this.name(),
filesetNamespace.level(0));
}
/**
diff --git
a/clients/client-java/src/main/java/com/datastrato/gravitino/client/MessagingCatalog.java
b/clients/client-java/src/main/java/com/datastrato/gravitino/client/MessagingCatalog.java
index c322ef0d5..2ce828a9a 100644
---
a/clients/client-java/src/main/java/com/datastrato/gravitino/client/MessagingCatalog.java
+++
b/clients/client-java/src/main/java/com/datastrato/gravitino/client/MessagingCatalog.java
@@ -104,7 +104,7 @@ public class MessagingCatalog extends BaseSchemaCatalog
implements TopicCatalog
/**
* Load the topic with the given identifier.
*
- * @param ident The identifier of the topic to load, which should be a
"schema.topic" style.
+ * @param ident The identifier of the topic to load, which should be
"schema.topic" format.
* @return The {@link Topic} with the specified identifier.
* @throws NoSuchTopicException if the topic with the specified identifier
does not exist.
*/
@@ -127,7 +127,7 @@ public class MessagingCatalog extends BaseSchemaCatalog
implements TopicCatalog
/**
* Create a new topic with the given identifier, comment, data layout and
properties.
*
- * @param ident A topic identifier, which should be a "schema.topic" style.
+ * @param ident A topic identifier, which should be "schema.topic" format.
* @param comment The comment of the topic object. Null is set if no comment
is specified.
* @param dataLayout The message schema of the topic object. Always null
because it's not
* supported yet.
@@ -166,7 +166,7 @@ public class MessagingCatalog extends BaseSchemaCatalog
implements TopicCatalog
/**
* Alter the topic with the given identifier.
*
- * @param ident A topic identifier, which should be a "schema.topic" style.
+ * @param ident A topic identifier, which should be "schema.topic" format.
* @param changes The changes to apply to the topic.
* @return The altered topic object.
* @throws NoSuchTopicException if the topic with the specified identifier
does not exist.
@@ -200,7 +200,7 @@ public class MessagingCatalog extends BaseSchemaCatalog
implements TopicCatalog
/**
* Drop the topic with the given identifier.
*
- * @param ident A topic identifier, which should be a "schema.topic" style.
+ * @param ident A topic identifier, which should be "schema.topic" format.
* @return True if the topic is dropped successfully, false the topic does
not exist.
*/
@Override
@@ -226,9 +226,9 @@ public class MessagingCatalog extends BaseSchemaCatalog
implements TopicCatalog
}
/**
- * Check whether the namespace of a topic is valid
+ * Check whether the namespace of a topic is valid.
*
- * @param namespace The namespace to check
+ * @param namespace The namespace to check.
*/
static void checkTopicNamespace(Namespace namespace) {
Namespace.check(
@@ -238,9 +238,9 @@ public class MessagingCatalog extends BaseSchemaCatalog
implements TopicCatalog
}
/**
- * Check whether the NameIdentifier of a topic is valid
+ * Check whether the NameIdentifier of a topic is valid.
*
- * @param ident The NameIdentifier to check
+ * @param ident The NameIdentifier to check, which should be "schema.topic"
format.
*/
static void checkTopicNameIdentifier(NameIdentifier ident) {
NameIdentifier.check(ident != null, "NameIdentifier must not be null");
@@ -249,8 +249,14 @@ public class MessagingCatalog extends BaseSchemaCatalog
implements TopicCatalog
checkTopicNamespace(ident.namespace());
}
- private Namespace getTopicFullNamespace(Namespace tableNamespace) {
- return Namespace.of(this.catalogNamespace().level(0), this.name(),
tableNamespace.level(0));
+ /**
+ * Get the full namespace of the topic with the given topic's short
namespace (schema name).
+ *
+ * @param topicNamespace The topic's short namespace, which is the schema
name.
+ * @return full namespace of the topic, which is "metalake.catalog.schema"
format.
+ */
+ private Namespace getTopicFullNamespace(Namespace topicNamespace) {
+ return Namespace.of(this.catalogNamespace().level(0), this.name(),
topicNamespace.level(0));
}
static class Builder extends CatalogDTO.Builder<Builder> {
diff --git
a/clients/client-java/src/main/java/com/datastrato/gravitino/client/RelationalCatalog.java
b/clients/client-java/src/main/java/com/datastrato/gravitino/client/RelationalCatalog.java
index 481e98c29..96521f195 100644
---
a/clients/client-java/src/main/java/com/datastrato/gravitino/client/RelationalCatalog.java
+++
b/clients/client-java/src/main/java/com/datastrato/gravitino/client/RelationalCatalog.java
@@ -107,7 +107,7 @@ public class RelationalCatalog extends BaseSchemaCatalog
implements TableCatalog
/**
* Load the table with specified identifier.
*
- * @param ident The identifier of the table to load, which should be a
"schema.table" style.
+ * @param ident The identifier of the table to load, which should be
"schema.table" format.
* @return The {@link Table} with specified identifier.
* @throws NoSuchTableException if the table with specified identifier does
not exist.
*/
@@ -130,7 +130,7 @@ public class RelationalCatalog extends BaseSchemaCatalog
implements TableCatalog
/**
* Create a new table with specified identifier, columns, comment and
properties.
*
- * @param ident The identifier of the table, which should be a
"schema.table" style.
+ * @param ident The identifier of the table, which should be "schema.table"
format.
* @param columns The columns of the table.
* @param comment The comment of the table.
* @param properties The properties of the table.
@@ -181,7 +181,7 @@ public class RelationalCatalog extends BaseSchemaCatalog
implements TableCatalog
/**
* Alter the table with specified identifier by applying the changes.
*
- * @param ident The identifier of the table, which should be a
"schema.table" style.
+ * @param ident The identifier of the table, which should be "schema.table"
format.
* @param changes Table changes to apply to the table.
* @return The altered {@link Table}.
* @throws NoSuchTableException if the table with specified identifier does
not exist.
@@ -215,7 +215,7 @@ public class RelationalCatalog extends BaseSchemaCatalog
implements TableCatalog
/**
* Drop the table with specified identifier.
*
- * @param ident The identifier of the table, which should be a
"schema.table" style.
+ * @param ident The identifier of the table, which should be "schema.table"
format.
* @return true if the table is dropped successfully, false if the table
does not exist.
*/
@Override
@@ -236,7 +236,7 @@ public class RelationalCatalog extends BaseSchemaCatalog
implements TableCatalog
/**
* Purge the table with specified identifier.
*
- * @param ident The identifier of the table, which should be a
"schema.table" style.
+ * @param ident The identifier of the table, which should be "schema.table"
format.
* @return true if the table is purged successfully, false otherwise.
*/
@Override
@@ -277,7 +277,7 @@ public class RelationalCatalog extends BaseSchemaCatalog
implements TableCatalog
/**
* Check whether the namespace of a table is valid, which should be "schema".
*
- * @param namespace The namespace to check
+ * @param namespace The namespace to check.
*/
static void checkTableNamespace(Namespace namespace) {
Namespace.check(
@@ -287,9 +287,9 @@ public class RelationalCatalog extends BaseSchemaCatalog
implements TableCatalog
}
/**
- * Check whether the NameIdentifier of a table is valid, which should be a
"schema.table" style.
+ * Check whether the NameIdentifier of a table is valid.
*
- * @param ident The NameIdentifier to check
+ * @param ident The NameIdentifier to check, which should be "schema.table"
format.
*/
static void checkTableNameIdentifier(NameIdentifier ident) {
NameIdentifier.check(ident != null, "NameIdentifier must not be null");
@@ -301,8 +301,8 @@ public class RelationalCatalog extends BaseSchemaCatalog
implements TableCatalog
/**
* Get the full namespace of the table with the given table's short
namespace (schema name).
*
- * @param tableNamespace The table's short namespace (schema name).
- * @return full namespace of the table (metalake.catalog.schema).
+ * @param tableNamespace The table's short namespace, which is the schema
name.
+ * @return full namespace of the table, which is "metalake.catalog.schema"
format.
*/
private Namespace getTableFullNamespace(Namespace tableNamespace) {
return Namespace.of(this.catalogNamespace().level(0), this.name(),
tableNamespace.level(0));
diff --git a/clients/client-python/gravitino/catalog/fileset_catalog.py
b/clients/client-python/gravitino/catalog/fileset_catalog.py
index cb38d0c6f..82c345411 100644
--- a/clients/client-python/gravitino/catalog/fileset_catalog.py
+++ b/clients/client-python/gravitino/catalog/fileset_catalog.py
@@ -101,7 +101,7 @@ class FilesetCatalog(BaseSchemaCatalog):
"""Load fileset metadata by {@link NameIdentifier} from the catalog.
Args:
- ident: A fileset identifier.
+ ident: A fileset identifier, which should be "schema.fileset"
format.
Raises:
NoSuchFilesetException If the fileset does not exist.
@@ -137,7 +137,7 @@ class FilesetCatalog(BaseSchemaCatalog):
If the type of the fileset object is "EXTERNAL", the underlying
storageLocation must be set.
Args:
- ident: A fileset identifier.
+ ident: A fileset identifier, which should be "schema.fileset"
format.
comment: The comment of the fileset.
fileset_type: The type of the fileset.
storage_location: The storage location of the fileset.
@@ -174,7 +174,7 @@ class FilesetCatalog(BaseSchemaCatalog):
"""Update a fileset metadata in the catalog.
Args:
- ident: A fileset identifier.
+ ident: A fileset identifier, which should be "schema.fileset"
format.
changes: The changes to apply to the fileset.
Args:
@@ -209,7 +209,7 @@ class FilesetCatalog(BaseSchemaCatalog):
metadata will be dropped.
Args:
- ident: A fileset identifier.
+ ident: A fileset identifier, which should be "schema.fileset"
format.
Returns:
true If the fileset is dropped, false the fileset did not exist.
diff --git a/docs/manage-fileset-metadata-using-gravitino.md
b/docs/manage-fileset-metadata-using-gravitino.md
index c94edf40e..33bd67035 100644
--- a/docs/manage-fileset-metadata-using-gravitino.md
+++ b/docs/manage-fileset-metadata-using-gravitino.md
@@ -69,8 +69,7 @@ Map<String, String> properties = ImmutableMap.<String,
String>builder()
// a storage location will be stored under this location.
.build();
-Catalog catalog = gravitinoClient.createCatalog(
- NameIdentifier.of("metalake", "catalog"),
+Catalog catalog = gravitinoClient.createCatalog("catalog",
Type.FILESET,
"hadoop", // provider, Gravitino only supports "hadoop" for now.
"This is a Hadoop fileset catalog",
@@ -83,7 +82,7 @@ Catalog catalog = gravitinoClient.createCatalog(
```python
gravitino_client: GravitinoClient =
GravitinoClient(uri="http://localhost:8090", metalake_name="metalake")
-catalog = gravitino_client.create_catalog(ident=NameIdentifier.of("metalake",
"catalog"),
+catalog = gravitino_client.create_catalog(name="catalog",
type=Catalog.Type.FILESET,
provider="hadoop",
comment="This is a Hadoop fileset
catalog",
@@ -167,7 +166,7 @@ GravitinoClient gravitinoClient = GravitinoClient
.build();
// Assuming you have just created a Hadoop catalog named `catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("catalog");
SupportsSchemas supportsSchemas = catalog.asSchemas();
@@ -176,8 +175,7 @@ Map<String, String> schemaProperties =
ImmutableMap.<String, String>builder()
// specifying storage location will be stored under this location.
.put("location", "file:/tmp/root/schema")
.build();
-Schema schema = supportsSchemas.createSchema(
- NameIdentifier.of("metalake", "catalog", "schema"),
+Schema schema = supportsSchemas.createSchema("schema",
"This is a schema",
schemaProperties
);
@@ -190,8 +188,8 @@ Schema schema = supportsSchemas.createSchema(
```python
gravitino_client: GravitinoClient =
GravitinoClient(uri="http://localhost:8090", metalake_name="metalake")
-catalog: Catalog =
gravitino_client.load_catalog(ident=NameIdentifier.of("metalake", "catalog"))
-catalog.as_schemas().create_schema(ident=NameIdentifier.of("metalake",
"catalog", "schema"),
+catalog: Catalog = gravitino_client.load_catalog(name="catalog")
+catalog.as_schemas().create_schema(name="schema",
comment="This is a schema",
properties={"location": "/tmp/root/schema"})
```
@@ -270,7 +268,7 @@ GravitinoClient gravitinoClient = GravitinoClient
.withMetalake("metalake")
.build();
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("catalog");
FilesetCatalog filesetCatalog = catalog.asFilesetCatalog();
Map<String, String> propertiesMap = ImmutableMap.<String, String>builder()
@@ -278,7 +276,7 @@ Map<String, String> propertiesMap = ImmutableMap.<String,
String>builder()
.build();
filesetCatalog.createFileset(
- NameIdentifier.of("metalake", "catalog", "schema", "example_fileset"),
+ NameIdentifier.of("schema", "example_fileset"),
"This is an example fileset",
Fileset.Type.MANAGED,
"file:/tmp/root/schema/example_fileset",
@@ -292,8 +290,8 @@ filesetCatalog.createFileset(
```python
gravitino_client: GravitinoClient =
GravitinoClient(uri="http://localhost:8090", metalake_name="metalake")
-catalog: Catalog =
gravitino_client.load_catalog(ident=NameIdentifier.of("metalake", "catalog"))
-catalog.as_fileset_catalog().create_fileset(ident=NameIdentifier.of("metalake",
"catalog", "schema", "example_fileset"),
+catalog: Catalog = gravitino_client.load_catalog(name="catalog")
+catalog.as_fileset_catalog().create_fileset(ident=NameIdentifier.of("schema",
"example_fileset"),
type=Fileset.Type.MANAGED,
comment="This is an example
fileset",
storage_location="/tmp/root/schema/example_fileset",
@@ -362,11 +360,11 @@ curl -X PUT -H "Accept:
application/vnd.gravitino.v1+json" \
```java
// ...
// Assuming you have just created a Fileset catalog named `catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("catalog");
FilesetCatalog filesetCatalog = catalog.asFilesetCatalog();
-Fileset f = filesetCatalog.alterFileset(NameIdentifier.of("metalake",
"catalog", "schema", "fileset"),
+Fileset f = filesetCatalog.alterFileset(NameIdentifier.of("schema", "fileset"),
FilesetChange.rename("fileset_renamed"),
FilesetChange.updateComment("xxx"));
// ...
```
@@ -377,12 +375,12 @@ Fileset f =
filesetCatalog.alterFileset(NameIdentifier.of("metalake", "catalog",
```python
gravitino_client: GravitinoClient =
GravitinoClient(uri="http://localhost:8090", metalake_name="metalake")
-catalog: Catalog =
gravitino_client.load_catalog(ident=NameIdentifier.of("metalake", "catalog"))
+catalog: Catalog = gravitino_client.load_catalog(name="catalog")
changes = (
FilesetChange.remove_property("fileset_properties_key1"),
FilesetChange.set_property("fileset_properties_key2",
"fileset_propertie_new_value"),
)
-fileset_new =
catalog.as_fileset_catalog().alter_fileset(NameIdentifier.of("metalake",
"catalog", "schema", "fileset"),
+fileset_new =
catalog.as_fileset_catalog().alter_fileset(NameIdentifier.of("schema",
"fileset"),
*changes)
```
@@ -419,12 +417,12 @@
http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/fil
```java
// ...
// Assuming you have just created a Fileset catalog named `catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("catalog");
FilesetCatalog filesetCatalog = catalog.asFilesetCatalog();
// Drop a fileset
-filesetCatalog.dropFileset(NameIdentifier.of("metalake", "catalog", "schema",
"fileset"));
+filesetCatalog.dropFileset(NameIdentifier.of("schema", "fileset"));
// ...
```
@@ -434,8 +432,8 @@ filesetCatalog.dropFileset(NameIdentifier.of("metalake",
"catalog", "schema", "f
```python
gravitino_client: GravitinoClient =
GravitinoClient(uri="http://localhost:8090", metalake_name="metalake")
-catalog: Catalog =
gravitino_client.load_catalog(ident=NameIdentifier.of("metalake", "catalog"))
-catalog.as_fileset_catalog().drop_fileset(ident=NameIdentifier.of("metalake",
"catalog", "schema", "fileset"))
+catalog: Catalog = gravitino_client.load_catalog(name="catalog")
+catalog.as_fileset_catalog().drop_fileset(ident=NameIdentifier.of("schema",
"fileset"))
```
</TabItem>
@@ -464,11 +462,11 @@
http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/fil
```java
// ...
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("catalog");
FilesetCatalog filesetCatalog = catalog.asFilesetCatalog();
NameIdentifier[] identifiers =
- filesetCatalog.listFilesets(Namespace.ofFileset("metalake", "catalog",
"schema"));
+ filesetCatalog.listFilesets(Namespace.of("schema"));
// ...
```
@@ -478,8 +476,8 @@ NameIdentifier[] identifiers =
```python
gravitino_client: GravitinoClient =
GravitinoClient(uri="http://localhost:8090", metalake_name="metalake")
-catalog: Catalog =
gravitino_client.load_catalog(ident=NameIdentifier.of("metalake", "catalog"))
-fileset_list: List[NameIdentifier] =
catalog.as_fileset_catalog().list_filesets(namespace=Namespace.of_fileset("metalake",
"catalog", "schema")))
+catalog: Catalog = gravitino_client.load_catalog(name="catalog")
+fileset_list: List[NameIdentifier] =
catalog.as_fileset_catalog().list_filesets(namespace=Namespace.of("schema")))
```
</TabItem>
diff --git a/docs/manage-messaging-metadata-using-gravitino.md
b/docs/manage-messaging-metadata-using-gravitino.md
index d84b65103..0b59f7b1d 100644
--- a/docs/manage-messaging-metadata-using-gravitino.md
+++ b/docs/manage-messaging-metadata-using-gravitino.md
@@ -59,8 +59,7 @@ Map<String, String> properties = ImmutableMap.<String,
String>builder()
.put("bootstrap.servers", "localhost:9092")
.build();
-Catalog catalog = gravitinoClient.createCatalog(
- NameIdentifier.of("metalake", "catalog"),
+Catalog catalog = gravitinoClient.createCatalog("catalog",
Type.MESSAGING,
"kafka", // provider, Gravitino only supports "kafka" for now.
"This is a Kafka catalog",
@@ -172,7 +171,7 @@ GravitinoClient gravitinoClient = GravitinoClient
.withMetalake("metalake")
.build();
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("catalog");
TopicCatalog topicCatalog = catalog.asTopicCatalog();
Map<String, String> propertiesMap = ImmutableMap.<String, String>builder()
@@ -181,7 +180,7 @@ Map<String, String> propertiesMap = ImmutableMap.<String,
String>builder()
.build();
topicCatalog.createTopic(
- NameIdentifier.of("metalake", "catalog", "default", "example_topic"),
+ NameIdentifier.of("default", "example_topic"),
"This is an example topic",
null, // The message schema of the topic object. Always null because it's
not supported yet.
propertiesMap,
@@ -222,11 +221,11 @@ curl -X PUT -H "Accept:
application/vnd.gravitino.v1+json" \
```java
// ...
// Assuming you have just created a Kafka catalog named `catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("catalog");
TopicCatalog topicCatalog = catalog.asTopicCatalog();
-Topic t = topicCatalog.alterTopic(NameIdentifier.of("metalake", "catalog",
"default", "topic"),
+Topic t = topicCatalog.alterTopic(NameIdentifier.of("default", "topic"),
TopicChange.removeProperty("key2"), TopicChange.setProperty("key3",
"value3"));
// ...
```
@@ -263,12 +262,12 @@
http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/default/to
```java
// ...
// Assuming you have just created a Kafka catalog named `catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("catalog");
TopicCatalog topicCatalog = catalog.asTopicCatalog();
// Drop a topic
-topicCatalog.dropTopic(NameIdentifier.of("metalake", "catalog", "default",
"topic"));
+topicCatalog.dropTopic(NameIdentifier.of("default", "topic"));
// ...
```
@@ -295,11 +294,11 @@
http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/top
```java
// ...
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("catalog");
TopicCatalog topicCatalog = catalog.asTopicCatalog();
NameIdentifier[] identifiers =
- topicCatalog.listTopics(Namespace.ofTopic("metalake", "catalog",
"default"));
+ topicCatalog.listTopics(Namespace.of("default"));
// ...
```
diff --git a/docs/manage-metalake-using-gravitino.md
b/docs/manage-metalake-using-gravitino.md
index b4510cfc2..6b4f9ee8e 100644
--- a/docs/manage-metalake-using-gravitino.md
+++ b/docs/manage-metalake-using-gravitino.md
@@ -54,7 +54,7 @@ GravitinoMetalake newMetalake =
gravitinoAdminClient.createMetalake(
```python
gravitino_admin_client: GravitinoAdminClient =
GravitinoAdminClient(uri="http://localhost:8090")
-gravitino_admin_client.create_metalake(ident=NameIdentifier.of("metalake"),
+gravitino_admin_client.create_metalake(name="metalake",
comment="This is a new metalake",
properties={})
```
@@ -88,7 +88,7 @@ GravitinoMetalake loaded = gravitinoAdminClient.loadMetalake(
<TabItem value="python" label="Python">
```python
-gravitino_admin_client.load_metalake(NameIdentifier.of("metalake"))
+gravitino_admin_client.load_metalake("metalake")
```
</TabItem>
@@ -141,7 +141,7 @@ changes = (
MetalakeChange.set_property("metalake_properties_key2",
"metalake_propertie_new_value"),
)
-metalake =
gravitino_admin_client.alter_metalake(NameIdentifier.of("metalake_name"),
*changes)
+metalake = gravitino_admin_client.alter_metalake("metalake_name", *changes)
```
</TabItem>
@@ -175,9 +175,7 @@ curl -X DELETE -H "Accept:
application/vnd.gravitino.v1+json" \
```java
// ...
-boolean success = gravitinoAdminClient.dropMetalake(
- NameIdentifier.of("metalake")
-);
+boolean success = gravitinoAdminClient.dropMetalake("metalake");
// ...
```
@@ -185,7 +183,7 @@ boolean success = gravitinoAdminClient.dropMetalake(
<TabItem value="python" label="Python">
```python
-gravitino_admin_client.drop_metalake(NameIdentifier.of("metalake"))
+gravitino_admin_client.drop_metalake("metalake")
```
</TabItem>
diff --git a/docs/manage-relational-metadata-using-gravitino.md
b/docs/manage-relational-metadata-using-gravitino.md
index 372d2e40c..6a7074952 100644
--- a/docs/manage-relational-metadata-using-gravitino.md
+++ b/docs/manage-relational-metadata-using-gravitino.md
@@ -74,8 +74,7 @@ Map<String, String> hiveProperties = ImmutableMap.<String,
String>builder()
.put("metastore.uris", "thrift://localhost:9083")
.build();
-Catalog catalog = gravitinoClient.createCatalog(
- NameIdentifier.of("metalake", "catalog"),
+Catalog catalog = gravitinoClient.createCatalog("catalog",
Type.RELATIONAL,
"hive", // provider, We support hive, jdbc-mysql, jdbc-postgresql,
lakehouse-iceberg, etc.
"This is a hive catalog",
@@ -114,7 +113,7 @@ curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
```java
// ...
// Assuming you have created a metalake named `metalake` and a catalog named
`catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("catalog");
// ...
```
@@ -151,7 +150,7 @@ curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \
```java
// ...
// Assuming you have created a metalake named `metalake` and a catalog named
`catalog`
-Catalog catalog = gravitinoClient.alterCatalog(NameIdentifier.of("metalake",
"catalog"),
+Catalog catalog = gravitinoClient.alterCatalog("catalog",
CatalogChange.rename("alter_catalog"), CatalogChange.updateComment("new
comment"));
// ...
```
@@ -187,7 +186,7 @@
http://localhost:8090/api/metalakes/metalake/catalogs/catalog
```java
// ...
// Assuming you have created a metalake named `metalake` and a catalog named
`catalog`
-gravitinoClient.dropCatalog(NameIdentifier.of("metalake", "catalog"));
+gravitinoClient.dropCatalog("catalog");
// ...
```
@@ -219,7 +218,7 @@ http://localhost:8090/api/metalakes/metalake/catalogs
```java
// ...
// Assuming you have just created a metalake named `metalake`
-NameIdentifier[] catalogsIdents =
gravitinoClient.listCatalogs(Namespace.ofCatalog("metalake"));
+String[] catalogNames = gravitinoClient.listCatalogs();
// ...
```
@@ -245,7 +244,7 @@
http://localhost:8090/api/metalakes/metalake/catalogs?details=true
```java
// ...
// Assuming you have just created a metalake named `metalake`
-Catalog[] catalogsInfos =
gravitinoMetalake.listCatalogsInfo(Namespace.ofCatalog("metalake"));
+Catalog[] catalogsInfos = gravitinoMetaLake.listCatalogsInfo();
// ...
```
@@ -282,14 +281,13 @@ curl -X POST -H "Accept:
application/vnd.gravitino.v1+json" \
```java
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"hive_catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("hive_catalog");
SupportsSchemas supportsSchemas = catalog.asSchemas();
Map<String, String> schemaProperties = ImmutableMap.<String, String>builder()
.build();
-Schema schema = supportsSchemas.createSchema(
- NameIdentifier.of("metalake", "hive_catalog", "schema"),
+Schema schema = supportsSchemas.createSchema("schema",
"This is a schema",
schemaProperties
);
@@ -301,8 +299,8 @@ Schema schema = supportsSchemas.createSchema(
```python
gravitino_client: GravitinoClient =
GravitinoClient(uri="http://127.0.0.1:8090", metalake_name="metalake")
-catalog: Catalog =
gravitino_client.load_catalog(ident=NameIdentifier.of("metalake",
"hive_catalog"))
-catalog.as_schemas().create_schema(ident=NameIdentifier.of("metalake",
"hive_catalog", "schema"),
+catalog: Catalog = gravitino_client.load_catalog(name="hive_catalog")
+catalog.as_schemas().create_schema(name="schema",
comment="This is a schema",
properties={})
```
@@ -339,9 +337,9 @@
http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema
```java
// ...
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"hive_catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("hive_catalog");
SupportsSchemas supportsSchemas = catalog.asSchemas();
-Schema schema = supportsSchemas.loadSchema(NameIdentifier.of("metalake",
"hive_catalog", "schema"));
+Schema schema = supportsSchemas.loadSchema("schema");
// ...
```
@@ -350,8 +348,8 @@ Schema schema =
supportsSchemas.loadSchema(NameIdentifier.of("metalake", "hive_c
```python
gravitino_client: GravitinoClient =
GravitinoClient(uri="http://127.0.0.1:8090", metalake_name="metalake")
-catalog: Catalog =
gravitino_client.load_catalog(ident=NameIdentifier.of("metalake",
"hive_catalog"))
-schema: Schema =
catalog.as_schemas().load_schema(ident=NameIdentifier.of("metalake",
"hive_catalog", "schema"))
+catalog: Catalog = gravitino_client.load_catalog(name="hive_catalog")
+schema: Schema = catalog.as_schemas().load_schema(name="schema")
```
</TabItem>
@@ -386,11 +384,11 @@ curl -X PUT -H "Accept:
application/vnd.gravitino.v1+json" \
```java
// ...
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"hive_catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("hive_catalog");
SupportsSchemas supportsSchemas = catalog.asSchemas();
-Schema schema = supportsSchemas.alterSchema(NameIdentifier.of("metalake",
"hive_catalog", "schema"),
+Schema schema = supportsSchemas.alterSchema("schema",
SchemaChange.removeProperty("key1"),
SchemaChange.setProperty("key2", "value2"));
// ...
@@ -401,13 +399,13 @@ Schema schema =
supportsSchemas.alterSchema(NameIdentifier.of("metalake", "hive_
```python
gravitino_client: GravitinoClient =
GravitinoClient(uri="http://127.0.0.1:8090", metalake_name="metalake")
-catalog: Catalog =
gravitino_client.load_catalog(ident=NameIdentifier.of("metalake",
"hive_catalog"))
+catalog: Catalog = gravitino_client.load_catalog(name="hive_catalog")
changes = (
SchemaChange.remove_property("schema_properties_key1"),
SchemaChange.set_property("schema_properties_key2",
"schema_propertie_new_value"),
)
-schema_new: Schema =
catalog.as_schemas().alter_schema(NameIdentifier.of("metalake", "hive_catalog",
"schema"),
+schema_new: Schema = catalog.as_schemas().alter_schema("schema",
*changes)
```
@@ -440,11 +438,11 @@
http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema?cas
```java
// ...
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"hive_catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("hive_catalog");
SupportsSchemas supportsSchemas = catalog.asSchemas();
// cascade can be true or false
-supportsSchemas.dropSchema(NameIdentifier.of("metalake", "hive_catalog",
"schema"), true);
+supportsSchemas.dropSchema("schema", true);
```
</TabItem>
@@ -452,9 +450,9 @@ supportsSchemas.dropSchema(NameIdentifier.of("metalake",
"hive_catalog", "schema
```python
gravitino_client: GravitinoClient =
GravitinoClient(uri="http://127.0.0.1:8090", metalake_name="metalake")
-catalog: Catalog =
gravitino_client.load_catalog(ident=NameIdentifier.of("metalake",
"hive_catalog"))
+catalog: Catalog = gravitino_client.load_catalog(name="hive_catalog")
-catalog.as_schemas().drop_schema(NameIdentifier.of("metalake", "hive_catalog",
"schema"), cascade=True)
+catalog.as_schemas().drop_schema("schema", cascade=True)
```
</TabItem>
@@ -483,10 +481,10 @@ curl -X GET -H "Accept:
application/vnd.gravitino.v1+json" \
```java
// ...
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"hive_catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("hive_catalog");
SupportsSchemas supportsSchemas = catalog.asSchemas();
-NameIdentifier[] schemas =
supportsSchemas.listSchemas(Namespace.ofSchema("metalake", "hive_catalog"));
+String[] schemas = supportsSchemas.listSchemas();
```
</TabItem>
@@ -494,9 +492,9 @@ NameIdentifier[] schemas =
supportsSchemas.listSchemas(Namespace.ofSchema("metal
```python
gravitino_client: GravitinoClient =
GravitinoClient(uri="http://127.0.0.1:8090", metalake_name="metalake")
-catalog: Catalog =
gravitino_client.load_catalog(ident=NameIdentifier.of("metalake",
"hive_catalog"))
+catalog: Catalog = gravitino_client.load_catalog(name="hive_catalog")
-schema_list: List[NameIdentifier] =
catalog.as_schemas().list_schemas(Namespace.of_schema("metalake",
"hive_catalog"))
+schema_list: List[NameIdentifier] = catalog.as_schemas().list_schemas()
```
</TabItem>
@@ -645,7 +643,7 @@ curl -X POST -H "Accept: application/vnd.gravitino.v1+json"
\
```java
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"hive_catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("hive_catalog");
TableCatalog tableCatalog = catalog.asTableCatalog();
@@ -657,7 +655,7 @@ Map<String, String> tablePropertiesMap =
ImmutableMap.<String, String>builder()
.build();
tableCatalog.createTable(
- NameIdentifier.of("metalake", "hive_catalog", "schema", "example_table"),
+ NameIdentifier.of("schema", "example_table"),
new Column[] {
Column.of("id", Types.IntegerType.get(), "id column comment", false, true,
Literals.integerLiteral(-1)),
Column.of("name", Types.VarCharType.of(500), "name column comment", true,
false, Literals.NULL),
@@ -858,10 +856,10 @@
http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tab
```java
// ...
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"hive_catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("hive_catalog");
TableCatalog tableCatalog = catalog.asTableCatalog();
-tableCatalog.loadTable(NameIdentifier.of("metalake", "hive_catalog", "schema",
"table"));
+tableCatalog.loadTable(NameIdentifier.of("schema", "table"));
// ...
```
@@ -902,11 +900,11 @@ curl -X PUT -H "Accept:
application/vnd.gravitino.v1+json" \
```java
// ...
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"hive_catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("hive_catalog");
TableCatalog tableCatalog = catalog.asTableCatalog();
-Table t = tableCatalog.alterTable(NameIdentifier.of("metalake",
"hive_catalog", "schema", "table"),
+Table t = tableCatalog.alterTable(NameIdentifier.of("schema", "table"),
TableChange.rename("table_renamed"), TableChange.updateComment("xxx"));
// ...
```
@@ -952,15 +950,15 @@
http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tab
```java
// ...
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"hive_catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("hive_catalog");
TableCatalog tableCatalog = catalog.asTableCatalog();
// Drop a table
-tableCatalog.dropTable(NameIdentifier.of("metalake", "hive_catalog", "schema",
"table"));
+tableCatalog.dropTable(NameIdentifier.of("schema", "table"));
// Purge a table
-tableCatalog.purgeTable(NameIdentifier.of("metalake", "hive_catalog",
"schema", "table"));
+tableCatalog.purgeTable(NameIdentifier.of("schema", "table"));
// ...
```
@@ -993,11 +991,11 @@
http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tab
```java
// ...
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake",
"hive_catalog"));
+Catalog catalog = gravitinoClient.loadCatalog("hive_catalog");
TableCatalog tableCatalog = catalog.asTableCatalog();
NameIdentifier[] identifiers =
- tableCatalog.listTables(Namespace.ofTable("metalake", "hive_catalog",
"schema"));
+ tableCatalog.listTables(Namespace.of("schema"));
// ...
```
diff --git a/docs/manage-table-partition-using-gravitino.md
b/docs/manage-table-partition-using-gravitino.md
index 4d0886e78..29e84b6cd 100644
--- a/docs/manage-table-partition-using-gravitino.md
+++ b/docs/manage-table-partition-using-gravitino.md
@@ -255,9 +255,9 @@ GravitinoClient gravitinoClient = GravitinoClient
// Assume that you have a partitioned table named
"metalake.catalog.schema.table".
Partition addedPartition =
gravitinoClient
- .loadCatalog(NameIdentifier.of("metalake", "catalog"))
+ .loadCatalog("catalog")
.asTableCatalog()
- .loadTable(NameIdentifier.of("metalake", "catalog", "schema", "table"))
+ .loadTable(NameIdentifier.of("schema", "table"))
.supportPartitions()
.addPartition(
Partitions.identity(
@@ -300,9 +300,9 @@ GravitinoClient gravitinoClient = GravitinoClient
// Assume that you have a partitioned table named
"metalake.catalog.schema.table".
Partition Partition =
gravitinoClient
- .loadCatalog(NameIdentifier.of("metalake", "catalog"))
+ .loadCatalog("catalog")
.asTableCatalog()
- .loadTable(NameIdentifier.of("metalake", "catalog", "schema", "table"))
+ .loadTable(NameIdentifier.of("schema", "table"))
.supportPartitions()
.getPartition("partition_name");
```
@@ -336,9 +336,9 @@ GravitinoClient gravitinoClient = GravitinoClient
// Assume that you have a partitioned table named
"metalake.catalog.schema.table".
String[] partitionNames =
gravitinoClient
- .loadCatalog(NameIdentifier.of("metalake", "catalog"))
+ .loadCatalog("catalog")
.asTableCatalog()
- .loadTable(NameIdentifier.of("metalake", "catalog", "schema", "table"))
+ .loadTable(NameIdentifier.of("schema", "table"))
.supportPartitions()
.listPartitionNames();
```
@@ -367,9 +367,9 @@
http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tab
// Assume that you have a partitioned table named
"metalake.catalog.schema.table".
Partition[] partitions =
gravitinoClient
- .loadCatalog(NameIdentifier.of("metalake", "catalog"))
+ .loadCatalog("catalog")
.asTableCatalog()
- .loadTable(NameIdentifier.of("metalake", "catalog", "schema",
"table"))
+ .loadTable(NameIdentifier.of("schema", "table"))
.supportPartitions()
.listPartitions();
```
@@ -407,9 +407,9 @@ GravitinoClient gravitinoClient = GravitinoClient
// Assume that you have a partitioned table named
"metalake.catalog.schema.table".
Partition Partition =
gravitinoClient
- .loadCatalog(NameIdentifier.of("metalake", "catalog"))
+ .loadCatalog("catalog")
.asTableCatalog()
- .loadTable(NameIdentifier.of("metalake", "catalog", "schema", "table"))
+ .loadTable(NameIdentifier.of("schema", "table"))
.supportPartitions()
.dropPartition("partition_name");
```
diff --git a/docs/table-partitioning-bucketing-sort-order-indexes.md
b/docs/table-partitioning-bucketing-sort-order-indexes.md
index c78fe4132..f0ca28b5c 100644
--- a/docs/table-partitioning-bucketing-sort-order-indexes.md
+++ b/docs/table-partitioning-bucketing-sort-order-indexes.md
@@ -211,7 +211,7 @@ curl -X POST -H "Accept: application/vnd.gravitino.v1+json"
\
```java
tableCatalog.createTable(
- NameIdentifier.of("metalake", "hive_catalog", "schema", "table"),
+ NameIdentifier.of("schema", "table"),
new Column[] {
Column.of("id", Types.IntegerType.get(), "Id of the user", true, false,
null),
Column.of("name", Types.VarCharType.of(2000), "Name of the user", true,
false, null),
@@ -328,7 +328,7 @@ curl -X POST -H "Accept: application/vnd.gravitino.v1+json"
\
```java
tableCatalog.createTable(
- NameIdentifier.of("metalake", "hive_catalog", "schema", "table"),
+ NameIdentifier.of("schema", "table"),
new Column[] {
Column.of("id", Types.IntegerType.get(), "Id of the user", false, true,
null),
Column.of("name", Types.VarCharType.of(1000), "Name of the user", true,
false, null),