Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#1986] improvement(docs): Fix some code issues in doc (#2005)

Qi Yu5478f583f26f
diff --git a/docs/manage-metadata-using-gravitino.md b/docs/manage-metadata-using-gravitino.md
index 52c2eb0a91..53d00f8247 100644
--- a/docs/manage-metadata-using-gravitino.md
+++ b/docs/manage-metadata-using-gravitino.md
@@ -729,24 +729,25 @@ Map<String, String> tablePropertiesMap = ImmutableMap.<String, String>builder()
.put("format", "ORC")
// For more table properties, please refer to the related doc.
.build();
+
tableCatalog.createTable(
- NameIdentifier.of("metalake", "catalog", "schema", "table"),
- new ColumnDTO[] {
- ColumnDTO.builder()
- .withComment("Id of the user")
- .withName("id")
- .withDataType(Types.IntegerType.get())
- .withNullable(true)
- .build(),
- ColumnDTO.builder()
- .withComment("Name of the user")
- .withName("name")
- .withDataType(Types.VarCharType.of(1000))
- .withNullable(true)
- .build(),
- },
- "Create a new Table",
- tablePropertiesMap
+ NameIdentifier.of("metalake", "catalog", "schema", "table"),
+ new Column[] {
+ Column.of("id", Types.IntegerType.get(), "id column comment", true, false, null),
+ Column.of("name", Types.VarCharType.of(1000), "name column comment", true, false, null),
+ Column.of("age", Types.IntegerType.get(), "age column comment", true, false, null),
+ Column.of("info", Types.StructType.of(
+ Field.nullableField("position", Types.StringType.get(), "Position of the user"),
+ Field.nullableField("contact", Types.ListType.of(Types.IntegerType.get(), false), "contact field comment"),
+ Field.nullableField("rating", Types.MapType.of(Types.VarCharType.of(1000), Types.IntegerType.get(), false), "rating field comment")
+ ), "info column comment", true, false, null),
+ Column.of("dt", Types.DateType.get(), "dt column comment", true, false, null)
+ },
+ "Create a new Table",
+ tablePropertiesMap,
+ new Transform[] {Transforms.identity("id")},
+ Distributions.of(Strategy.HASH, 32, NamedReference.field("id")),
+ new SortOrder[] {SortOrders.ascending(NamedReference.field("name"))}
);
```
@@ -819,7 +820,7 @@ In addition to the basic settings, Gravitino supports the following features:
| Feature | Description | Java doc |
|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|
-| Table partitioning | Equal to `PARTITION BY` in Apache Hive, It is a partitioning strategy that is used to split a table into parts based on partition keys. Some table engine may not support this feature | [Partition](pathname:///docs/0.4.0/api/java/com/datastrato/gravitino/dto/rel/partitions/Partitioning.html) |
+| Table partitioning | Equal to `PARTITION BY` in Apache Hive, It is a partitioning strategy that is used to split a table into parts based on partition keys. Some table engine may not support this feature | [Partition](pathname:///docs/0.4.0/api/java/com/datastrato/gravitino/dto/rel/partitioning/Partitioning.html) |
| Table bucketing | Equal to `CLUSTERED BY` in Apache Hive, Bucketing a.k.a (Clustering) is a technique to split the data into more manageable files/parts, (By specifying the number of buckets to create). The value of the bucketing column will be hashed by a user-defined number into buckets. | [Distribution](pathname:///docs/0.4.0/api/java/com/datastrato/gravitino/rel/expressions/distributions/Distribution.html) |
| Table sort ordering | Equal to `SORTED BY` in Apache Hive, sort ordering is a method to sort the data in specific ways such as by a column or a function, and then store table data. it will highly improve the query performance under certain scenarios. | [SortOrder](pathname:///docs/0.4.0/api/java/com/datastrato/gravitino/rel/expressions/sorts/SortOrder.html) |
| Table indexing | Equal to `KEY/INDEX` in MySQL , unique key enforces uniqueness of values in one or more columns within a table. It ensures that no two rows have identical values in specified columns, thereby facilitating data integrity and enabling efficient data retrieval and manipulation operations. | [Index](pathname:///docs/0.4.0/api/java/com/datastrato/gravitino/rel/indexes/Index.html) |
diff --git a/docs/table-partitioning-bucketing-sort-order-indexes.md b/docs/table-partitioning-bucketing-sort-order-indexes.md
index d7895ae950..c43a76eb21 100644
--- a/docs/table-partitioning-bucketing-sort-order-indexes.md
+++ b/docs/table-partitioning-bucketing-sort-order-indexes.md
@@ -125,7 +125,7 @@ Note: If the direction value is `ascending`, the default ordering value is `null
<TabItem value="java" label="Java">
```java
-SortOrders.of(FieldReferenceDTO.of("score"), SortDirection.ASCENDING, NullOrdering.NULLS_LAST);
+SortOrders.of(NamedReference.field("score"), SortDirection.ASCENDING, NullOrdering.NULLS_LAST);
```
</TabItem>
@@ -210,31 +210,11 @@ curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
```java
tableCatalog.createTable(
NameIdentifier.of("metalake", "hive_catalog", "schema", "table"),
- new ColumnDTO[] {
- ColumnDTO.builder()
- .withComment("Id of the user")
- .withName("id")
- .withDataType(Types.IntegerType.get())
- .withNullable(true)
- .build(),
- ColumnDTO.builder()
- .withComment("Name of the user")
- .withName("name")
- .withDataType(Types.VarCharType.of(1000))
- .withNullable(true)
- .build(),
- ColumnDTO.builder()
- .withComment("Age of the user")
- .withName("age")
- .withDataType(Types.ShortType.get())
- .withNullable(true)
- .build(),
- ColumnDTO.builder()
- .withComment("Score of the user")
- .withName("score")
- .withDataType(Types.DoubleType.get())
- .withNullable(true)
- .build(),
+ 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),
+ Column.of("age", Types.ShortType.get(), "Age of the user", true, false, null),
+ Column.of("score", Types.DoubleType.get(), "Score of the user", false, false, null)
},
"Create a new Table",
tablePropertiesMap,
@@ -243,7 +223,7 @@ tableCatalog.createTable(
Transforms.identity("score")
},
// CLUSTERED BY id
- Distributions.of(Strategy.HASH, 4, NamedReference.field("id")),,
+ Distributions.of(Strategy.HASH, 4, NamedReference.field("id")),
// SORTED BY name asc
new SortOrder[] {
SortOrders.of(