This is an automated email from the ASF dual-hosted git repository.

jshao 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 997feb6511 [#7273] docs: Add documents for statistics (#8229)
997feb6511 is described below

commit 997feb6511eca63faa2dbc7b90da4c27c4f49ac1
Author: roryqi <[email protected]>
AuthorDate: Fri Aug 29 16:48:45 2025 +0800

    [#7273] docs: Add documents for statistics (#8229)
    
    ### What changes were proposed in this pull request?
    
    Add documents for statistics
    
    ### Why are the changes needed?
    
    
    Fix: #7273
    
    ### Does this PR introduce _any_ user-facing change?
    
    Add documents.
    
    ### How was this patch tested?
    No need.
---
 docs/index.md                                      |   2 +
 docs/manage-relational-metadata-using-gravitino.md |   2 +
 docs/manage-statistics-in-gravitino.md             | 299 ++++++++++++
 docs/open-api/openapi.yaml                         |   6 +
 docs/open-api/statistics.yaml                      | 508 +++++++++++++++++++++
 5 files changed, 817 insertions(+)

diff --git a/docs/index.md b/docs/index.md
index ec081359b3..0a765dd5f9 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -87,6 +87,8 @@ Gravitino currently supports the following catalogs:
 * [**OceanBase catalog**](./jdbc-oceanbase-catalog.md)
 * [**StarRocks catalog**](./jdbc-starrocks-catalog.md)
 
+If you want to operate table and partition statistics, you can refer to the 
[document](./manage-statistics-in-gravitino.md).
+
 **Fileset catalogs:**
 
 * [**Fileset catalog**](./fileset-catalog.md)
diff --git a/docs/manage-relational-metadata-using-gravitino.md 
b/docs/manage-relational-metadata-using-gravitino.md
index 4ae552b952..1bb1f10a4b 100644
--- a/docs/manage-relational-metadata-using-gravitino.md
+++ b/docs/manage-relational-metadata-using-gravitino.md
@@ -28,6 +28,8 @@ For more details, please refer to the related doc.
 - [**Apache Paimon**](./lakehouse-paimon-catalog.md)
 - [**Apache Hudi**](./lakehouse-hudi-catalog.md)
 
+If you want to operate table and partition statistics, you can refer to the 
[document](./manage-statistics-in-gravitino.md).
+
 Assuming:
 
  - Gravitino has just started, and the host and port is 
[http://localhost:8090](http://localhost:8090).
diff --git a/docs/manage-statistics-in-gravitino.md 
b/docs/manage-statistics-in-gravitino.md
new file mode 100644
index 0000000000..4902726a06
--- /dev/null
+++ b/docs/manage-statistics-in-gravitino.md
@@ -0,0 +1,299 @@
+---
+title: "Manage statistics in Gravitino"
+slug: /manage-statistics-in-gravitino
+date: 2025-08-21
+keyword: statistics management, statistics, statistic, Gravitino
+license: This software is licensed under the Apache License version 2.
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+## Introduction
+
+Starting from 1.0.0, Gravitino introduces statistics of tables and partitions.
+
+This document provides a brief introduction using both Gravitino Java client 
and
+REST APIs. If you want to know more about the statistics system in Gravitino, 
please refer to the
+Javadoc and REST API documentation.
+
+Statistics only support the custom statistics, which names must start with 
`custom-`.
+Gravitino will support built-in statistics in the future.
+
+The query engine uses statistics for cost-based optimization (CBO). Meanwhile, 
statistics can also
+be used for metadata action systems to trigger some jobs, such as compaction, 
data archiving, etc.
+
+You can create statistics. And then you can create policies based on 
statistics. Users can analyze the statistics
+and policies to decide the next action. For example,
+you can create a statistic named `custom-tableLastModifiedTime` to record the 
last modified time of a table.
+Then you can create a policy to check if the table hasn't been modified for a 
long time, and archive the table data to
+cold storage.
+
+Currently, Gravitino doesn't handle the computation of the statistics, you 
need to compute the statistics
+and update them to Gravitino. Gravitino can't judge the expiration of the 
statistics, 
+You need to ensure the statistics are up-to-date.
+
+
+## Metadata object statistic operations
+
+### Update statistics of metadata objects
+
+You can update the statistics of a metadata object by providing the statistics 
key and value.
+Now only table statistics can be updated.
+
+The request path for REST API is 
`/api/metalakes/{metalake}/objects/{metadataObjectType}/{metadataObjectName}/statistics`.
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{
+  "updates" : {
+      "custom-tableLastModifiedTime": "20250128",
+  }
+}' 
http://localhost:8090/api/metalakes/metalake/objects/table/catalog.schema.table/statistics
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+Table table = ...
+Map<String, StatisticValue<?>> updateStatistics = Maps.newHashMap();
+updateStatistics.put("custom-k1", StatisticValues.stringValue("v1"));
+updateStatistics.put("custom-k2", StatisticValues.stringValue("v2"));
+table.updateStatistics(updateStatistics);
+```
+
+</TabItem>
+</Tabs>
+
+### List statistics of metadata objects
+
+You can list all the statistics of a metadata object.
+Now only table statistics can be listed.
+
+The request path for REST API is 
`/api/metalakes/{metalake}/objects/{metadataObjectType}/{metadataObjectName}/statistics`.
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
+ -H "Content-Type: application/json" \
+ 
http://localhost:8090/api/metalakes/metalake/objects/table/catalog.schema.table/statistics
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+Table table = ...
+table.listStatistics();
+```
+
+</TabItem>
+</Tabs>
+
+### Drop statistics of metadata objects
+
+You can drop the statistics of a metadata object by providing the statistics 
keys.
+Now only table statistics can be dropped.
+
+The request path for REST API is 
`/api/metalakes/{metalake}/objects/{metadataObjectType}/{metadataObjectName}/statistics`.
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
+ -H "Content-Type: application/json" -d '{
+ "names":["custom-k1"]
+}' 
http://localhost:8090/api/metalakes/metalake/objects/table/catalog.schema.table/statistics
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+Table table = ...
+List<String> statisticsToDrop = Lists.newArrayList("custom-k1");
+table.dropStatistics(statisticsToDrop);
+```
+
+</TabItem>
+</Tabs>
+
+### Partition statistics operations
+
+### Update statistics of partitions
+
+You can update the statistics of a partition by providing the statistics key 
and value. If the statistics
+already exist, it will be updated; otherwise, a new statistic will be created.
+
+The request path for REST API is 
`/api/metalakes/{metalake}/objects/table/{metadataObjectName}/statistics/partitions`.
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{
+  "updates":[{
+  "partitionName" : "p0" ,
+  "statistics" : {
+    "custom-k1" : "v1"
+  }
+  }]
+}' 
http://localhost:8090/api/metalakes/metalake/objects/table/catalog.schema.table/statistics/partitions
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+Table table = ...
+List<PartitionStatisticsUpdate> statisticsToUpdate = Lists.newArrayList();
+Map<String, StatisticValue<?>> stats = Maps.newHashMap();
+stats.put("custom-k1", StatisticValues.stringValue("v1"));
+stats.put("custom-k2", StatisticValues.stringValue("v2"));
+statisticsToUpdate.add(PartitionStatisticsModification.update("p1", stats));
+table.updatePartitionStatistics(statisticsToUpdate);
+```
+
+</TabItem>
+</Tabs>
+
+
+### List statistics of partitions
+
+You can list the statistics of specified partitions.
+You can specify a range of partitions by providing the `from` and `to` 
parameters,
+and whether the range is inclusive using `fromInclusive` and `toInclusive` 
parameters.
+
+The request path for REST API is 
`/api/metalakes/{metalake}/objects/table/{metadataObjectName}/statistics/partitions`.
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
+ -H "Content-Type: application/json" \
+ 
'http://localhost:8090/api/metalakes/metalake/objects/table/catalog.schema.table/statistics/partitions?from=p0&to=p1&fromInclusive=true&toInclusive=false'
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+Table table = ...
+PartitionRange range = PartitionRange.downTo("p0", 
PartitionRange.BoundType.CLOSED);
+table.listPartitionStatistics(range);
+```
+
+</TabItem>
+</Tabs>
+
+
+### Drop statistics of partitions
+
+You can drop the statistics of specified partitions by providing the 
statistics keys.
+
+The request path for REST API is 
`/api/metalakes/{metalake}/objects/table/{metadataObjectName}/statistics/partitions`.
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{
+  "drops" : [{
+  "partitionName" : "p0",
+  "statisticNames": ["custom-k1"]
+  }]
+}' 
http://localhost:8090/api/metalakes/metalake/objects/table/catalog.schema.table/statistics/partitions
 
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+
+List<PartitionStatisticsDrop> statisticsToDrop = Lists.newArrayList();
+statisticsToDrop.add(
+    PartitionStatisticsModification.drop("p0", 
Lists.newArrayList("custom-k1")));
+
+table.dropPartitionStatistics(statisticsToDrop);
+
+```
+
+</TabItem>
+</Tabs>
+
+
+### Server configuration
+
+| Configuration item                                  | Description            
                                                                                
                                                                                
                                              | Default value                   
                                           | Required                           
             | Since version |
+|-----------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|-------------------------------------------------|---------------|
+| `gravitino.stats.partition.storageFactoryClass`     | The storage factory 
class for partition statistics, which is used to store partition statistics in 
the different storage. The 
`org.apache.gravitino.stats.storage.MemoryPartitionStatsStorageFactory`  can 
only be used for testing. | 
`org.apache.gravitino.stats.storage.LancePartitionStatisticStorageFactory` |  
No                                             | 1.0.0         |
+
+
+If you use [Lance](https://lancedb.github.io/lance/) as the partition 
statistics storage, you can set the options below, if you have other lance 
storage options, you can pass it by adding prefix 
`gravitino.stats.partition.storageOption.`.
+For example, if you set an extra property `foo` to `bar` for Lance storage 
option, you can add a configuration item 
`gravitino.stats.partition.storageOption.foo` with value `bar`.
+
+For Lance remote storage, you can refer to the document 
[here](https://lancedb.github.io/lance/usage/storage/).
+
+
+| Configuration item                                        | Description      
                    | Default value                  | Required                 
                       | Since version |
+|-----------------------------------------------------------|--------------------------------------|--------------------------------|-------------------------------------------------|---------------|
+| `gravitino.stats.partition.storageOption.location`        | The location of 
Lance files          | `${GRAVITINO_HOME}/data/lance` | No                      
                        | 1.0.0         |
+| `gravitino.stats.partition.storageOption.maxRowsPerFile`  | The maximum rows 
per file            | `1000000`                      | No                       
                       | 1.0.0         |
+| `gravitino.stats.partition.storageOption.maxBytesPerFile` | The maximum 
bytes per file           | `104857600`                    | No                  
                            | 1.0.0         |
+| `gravitino.stats.partition.storageOption.maxRowsPerGroup` | The maximum rows 
per group           | `1000000`                      | No                       
                       | 1.0.0         |
+| `gravitino.stats.partition.storageOption.readBatchSize`   | The batch record 
number when reading | `10000`                        | No                       
                       | 1.0.0         |
+
+### Implementation a custom partition storage
+
+You can implement a custom partition storage by implementing the interface 
`org.apache.gravitino.stats.storage.PartitionStatisticStorageFactory` and
+setting the configuration item `gravitino.stats.partition.storageFactoryClass` 
to your class name.
+
+For example:
+
+```java
+public class MyPartitionStatsStorageFactory implements 
PartitionStatisticStorageFactory {
+    @Override
+    public PartitionStatisticStorage create(Map<String, String> options) {
+        // Create your custom PartitionStatsStorage here
+        return new MyPartitionStatsStorage(...);
+    }
+}
+```
+
+```java
+public class MyPartitionStatsStorage implements PartitionStatisticStorage {
+
+
+    @Override
+    public void close() {
+        // Close your storage here
+    }
+
+    @Override
+    public void updateStatistics(String metalake, 
List<MetadataObjectStatisticsUpdate> updates) {
+        // Update partition statistics in your storage here
+    }
+
+    @Override
+    public List<PersistedPartitionStatistics> listStatistics(
+            String metalake, MetadataObject metadataObject, PartitionRange 
range) {
+        // List partition statistics from your storage here
+        return Maps.newHashMap();
+    }
+
+    @Override
+    public int dropStatistics(String metalake, 
List<MetadataObjectStatisticsDrop> drops) {    
+        // Drop partition statistics from your storage here
+    }
+}
+```
diff --git a/docs/open-api/openapi.yaml b/docs/open-api/openapi.yaml
index a802947ff3..abed7d55f1 100644
--- a/docs/open-api/openapi.yaml
+++ b/docs/open-api/openapi.yaml
@@ -65,6 +65,12 @@ paths:
   
/metalakes/{metalake}/objects/{metadataObjectType}/{metadataObjectFullName}/tags:
     $ref: 
"./tags.yaml#/paths/~1metalakes~1%7Bmetalake%7D~1objects~1%7BmetadataObjectType%7D~1%7BmetadataObjectFullName%7D~1tags"
 
+  
/metalakes/{metalake}/objects/{metadataObjectType}/{metadataObjectFullName}/statistics:
+    $ref: 
"./statistics.yaml#/paths/~1metalakes~1%7Bmetalake%7D~1objects~1%7BmetadataObjectType%7D~1%7BmetadataObjectFullName%7D~1statistics"
+
+  
/metalakes/{metalake}/objects/{metadataObjectType}/{metadataObjectFullName}/statistics/partitions:
+    $ref: 
"./statistics.yaml#/paths/~1metalakes~1%7Bmetalake%7D~1objects~1%7BmetadataObjectType%7D~1%7BmetadataObjectFullName%7D~1statistics~1partitions"
+
   /metalakes/{metalake}/policies:
     $ref: "./policies.yaml#/paths/~1metalakes~1%7Bmetalake%7D~1policies"
 
diff --git a/docs/open-api/statistics.yaml b/docs/open-api/statistics.yaml
new file mode 100644
index 0000000000..8c619a447f
--- /dev/null
+++ b/docs/open-api/statistics.yaml
@@ -0,0 +1,508 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+---
+
+paths:
+
+  
/metalakes/{metalake}/objects/{metadataObjectType}/{metadataObjectFullName}/statistics:
+    parameters:
+      - $ref: "./openapi.yaml#/components/parameters/metalake"
+      - $ref: "./openapi.yaml#/components/parameters/metadataObjectType"
+      - $ref: "./openapi.yaml#/components/parameters/metadataObjectFullName"
+
+    get:
+      tags:
+        - statistics
+      summary: List statistics
+      operationId: listStatistics
+
+      responses:
+        "200":
+            description: Returns the statistics for the specified metadata 
object
+            content:
+              application/vnd.gravitino.v1+json:
+                schema:
+                  $ref: "#/components/responses/StatisticListResponse"
+                examples:
+                  StatisticListResponse:
+                    $ref: "#/components/examples/StatisticListResponse"
+        "404":
+          description: Not Found - The specified metadata object doesn't exist
+          content:
+            application/vnd.gravitino.v1+json:
+              schema:
+                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+              examples:
+                NoSuchMetadataObjectException:
+                  $ref: "#/components/examples/NoSuchMetadataObjectException"
+        "5xx":
+          $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
+
+    post:
+      tags:
+        - statistics
+      summary: Drop statistics
+      operationId: dropStatistics
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: "#/components/schemas/StatisticsDropRequest"
+
+      responses:
+        "200":
+          $ref: "./openapi.yaml#/components/responses/DropResponse"
+        "400":
+          description: Bad Request - The request contains illegal statistic 
names
+          content:
+            application/vnd.gravitino.v1+json:
+              schema:
+                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+              examples:
+                IllegalStatisticNameException:
+                  $ref: "#/components/examples/IllegalStatisticNameException"
+        "404":
+          description: Not Found - The specified metadata object doesn't exist
+          content:
+            application/vnd.gravitino.v1+json:
+              schema:
+                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+              examples:
+                NoSuchMetadataObjectException:
+                  $ref: "#/components/examples/NoSuchMetadataObjectException"
+        "405":
+          description: Method Not Allowed - The specified statistic is 
unmodifiable
+          content:
+            application/vnd.gravitino.v1+json:
+              schema:
+                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+              examples:
+                UnmodifiableStatisticException:
+                  $ref: "#/components/examples/UnmodifiableStatisticException"
+        "5xx":
+          $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
+
+    put:
+      tags:
+        - statistics
+      summary: Update statistics
+      operationId: updateStatistics
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: "#/components/schemas/StatisticsUpdateRequest"
+
+      responses:
+        "200":
+          $ref: "./openapi.yaml#/components/responses/BaseResponse"
+        "400":
+          description: Bad Request - The request contains illegal statistic 
names
+          content:
+            application/vnd.gravitino.v1+json:
+              schema:
+                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+              examples:
+                IllegalStatisticNameException:
+                  $ref: "#/components/examples/IllegalStatisticNameException"
+        "404":
+          description: Not Found - The specified metadata object doesn't exist
+          content:
+            application/vnd.gravitino.v1+json:
+              schema:
+                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+              examples:
+                NoSuchMetadataObjectException:
+                  $ref: "#/components/examples/NoSuchMetadataObjectException"
+        "405":
+          description: Method Not Allowed - The specified statistic is 
unmodifiable
+          content:
+            application/vnd.gravitino.v1+json:
+              schema:
+                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+              examples:
+                UnmodifiableStatisticException:
+                  $ref: "#/components/examples/UnmodifiableStatisticException"
+        "5xx":
+          $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
+
+  
/metalakes/{metalake}/objects/{metadataObjectType}/{metadataObjectFullName}/statistics/partitions:
+    parameters:
+      - $ref: "./openapi.yaml#/components/parameters/metalake"
+      - $ref: "./openapi.yaml#/components/parameters/metadataObjectType"
+      - $ref: "./openapi.yaml#/components/parameters/metadataObjectFullName"
+
+    get:
+      tags:
+        - partition-statistics
+      summary: List partition statistics
+      operationId: listPartitionStatistics
+      parameters:
+        - $ref: "#/components/parameters/from"
+        - $ref: "#/components/parameters/to"
+        - $ref: "#/components/parameters/fromInclusive"
+        - $ref: "#/components/parameters/toInclusive"
+      responses:
+        "200":
+            description: Returns the partition statistics for the specified 
metadata object
+            content:
+              application/vnd.gravitino.v1+json:
+                schema:
+                  $ref: 
"#/components/responses/PartitionStatisticsListResponse"
+                examples:
+                  PartitionStatisticsListResponse:
+                    $ref: 
"#/components/examples/PartitionStatisticListResponse"
+        "400":
+          $ref: "./openapi.yaml#/components/responses/BadRequestErrorResponse"
+        "404":
+          description: Not Found - The specified metadata object doesn't exist
+          content:
+            application/vnd.gravitino.v1+json:
+              schema:
+                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+              examples:
+                NoSuchMetadataObjectException:
+                  $ref: "#/components/examples/NoSuchMetadataObjectException"
+        "5xx":
+          $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
+
+    post:
+      tags:
+        - partition-statistics
+      summary: Drop partition statistics
+      operationId: dropPartitionStatistics
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: "#/components/schemas/PartitionStatisticsDropRequest"
+
+      responses:
+        "200":
+          $ref: "./openapi.yaml#/components/responses/DropResponse"
+        "400":
+          description: Bad Request - The request contains illegal statistic 
names
+          content:
+            application/vnd.gravitino.v1+json:
+              schema:
+                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+              examples:
+                IllegalStatisticNameException:
+                  $ref: "#/components/examples/IllegalStatisticNameException"
+        "404":
+          description: Not Found - The specified metadata object doesn't exist
+          content:
+            application/vnd.gravitino.v1+json:
+              schema:
+                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+              examples:
+                NoSuchMetadataObjectException:
+                  $ref: "#/components/examples/NoSuchMetadataObjectException"
+        "405":
+          description: Method Not Allowed - The specified statistic is 
unmodifiable
+          content:
+            application/vnd.gravitino.v1+json:
+              schema:
+                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+              examples:
+                UnmodifiableStatisticException:
+                  $ref: "#/components/examples/UnmodifiableStatisticException"
+        "5xx":
+          $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
+
+    put:
+      tags:
+        - partition-statistics
+      summary: Update partition statistics
+      operationId: updatePartitionStatistics
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: "#/components/schemas/PartitionStatisticsUpdateRequest"
+
+      responses:
+        "200":
+          $ref: "./openapi.yaml#/components/responses/BaseResponse"
+        "400":
+          description: Bad Request - The request contains illegal statistic 
names
+          content:
+            application/vnd.gravitino.v1+json:
+              schema:
+                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+              examples:
+                IllegalStatisticNameException:
+                  $ref: "#/components/examples/IllegalStatisticNameException"
+        "404":
+          description: Not Found - The specified metadata object doesn't exist
+          content:
+            application/vnd.gravitino.v1+json:
+              schema:
+                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+              examples:
+                NoSuchMetadataObjectException:
+                  $ref: "#/components/examples/NoSuchMetadataObjectException"
+        "405":
+          description: Method Not Allowed - The specified statistic is 
unmodifiable
+          content:
+            application/vnd.gravitino.v1+json:
+              schema:
+                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+              examples:
+                UnmodifiableStatisticException:
+                  $ref: "#/components/examples/UnmodifiableStatisticException"
+        "5xx":
+          $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
+
+
+components:
+  parameters:
+    from:
+      name: from
+      in: query
+      description: The lower partition name
+      required: false
+      schema:
+        type: string
+
+    to:
+      name: to
+      in: query
+      description: The upper partition name
+      required: false
+      schema:
+        type: string
+
+    fromInclusive:
+      name: fromInclusive
+      in: query
+      description: Whether the lower partition name is inclusive
+      required: false
+      schema:
+        type: boolean
+
+    toInclusive:
+      name: toInclusive
+      in: query
+      description: Whether the upper partition name is inclusive
+      required: false
+      schema:
+        type: string
+
+
+  schemas:
+    StatisticsDropRequest:
+      type: object
+      required:
+        - names
+      properties:
+        names:
+          type: array
+          items:
+            type: string
+          description: The names of the statistics to drop for the metadata 
object
+
+    StatisticsUpdateRequest:
+      type: object
+      required:
+        - updates
+      properties:
+          updates:
+            type: object
+            additionalProperties: {}
+            description: The statistics to update for each partition
+
+    PartitionStatisticsDropRequest:
+        type: object
+        required:
+            - drops
+        properties:
+            drops:
+              type: array
+              items:
+                $ref: "#/components/schemas/PartitionStatisticsDrop"
+              description: The list of partition statistics to drop
+
+    PartitionStatisticsDrop:
+        type: object
+        required:
+            - partitionName
+            - statisticNames
+        properties:
+            partitionName:
+              type: string
+              description: The name of the partition
+            statisticNames:
+              type: array
+              items:
+                type: string
+              description: The names of the statistics to drop for the 
partition
+
+
+    PartitionStatisticsUpdateRequest:
+      type: object
+      required:
+        - updates
+      properties:
+        updates:
+          type: array
+          items:
+            $ref: "#/components/schemas/PartitionStatisticsUpdate"
+          description: The list of partition statistics to update
+
+    PartitionStatisticsUpdate:
+        type: object
+        required:
+            - partitionName
+            - statistics
+        properties:
+            partitionName:
+              type: string
+              description: The name of the partition
+            statistics:
+              type: object
+              additionalProperties: {}
+              description: The statistics to update for the partition
+
+
+  responses:
+    StatisticListResponse:
+        type: object
+        properties:
+            code:
+              type: integer
+              format: int32
+              description: Status code of the response
+              enum:
+                - 0
+            statistics:
+              type: object
+              additionalProperties: {}
+              description: A map of statistic names to their values for the 
metadata object
+
+
+    PartitionStatisticsListResponse:
+        type: object
+        properties:
+            code:
+              type: integer
+              format: int32
+              description: Status code of the response
+              enum:
+                - 0
+            partitionStatistics:
+              type: object
+              additionalProperties:
+                type: object
+                additionalProperties: {}
+              description: A map of partition names to their statistics (which 
is a map of statistic names to their values)
+
+  examples:
+    StatisticsDropRequest:
+      value: {
+        "names": [ "row_count", "file_size" ]
+      }
+
+    StatisticsUpdateRequest:
+      value: {
+        "stats": {
+          "row_count": "1000",
+          "file_size": "500MB"
+        }
+      }
+
+    PartitionStatisticsDropRequest:
+      value: {
+        "drops": [
+          {
+            "partitionName": "2023-10-01",
+            "statisticNames": [ "row_count", "file_size" ]
+          }
+        ]
+      }
+
+    PartitionStatisticUpdateRequest:
+      value: {
+        "updates": [
+          {
+            "partitionName": "2023-10-01",
+            "stats": {
+              "row_count": "500",
+              "file_size": "250MB"
+            }
+          }
+        ]
+      }
+
+    StatisticListResponse:
+        value: {
+            "code": 0,
+            "statistics": {
+                "row_count": "1000",
+                "file_size": "500MB"
+            }
+        }
+
+
+    PartitionStatisticListResponse:
+        value: {
+            "code": 0,
+            "partitionStatistics": {
+                "2023-10-01": {
+                    "row_count": "500",
+                    "file_size": "250MB"
+                },
+                "2023-10-02": {
+                    "row_count": "600",
+                    "file_size": "300MB"
+                }
+            }
+        }
+
+    NoSuchMetadataObjectException:
+      value: {
+        "code": 1003,
+        "type": "NoSuchMetadataObjectException",
+        "message": "Metadata object does not exist",
+        "stack": [
+          "org.apache.gravitino.exceptions.NoSuchMetadataObjectException: 
Metadata object does not exist",
+          "..."
+        ]
+      }
+
+    IllegalStatisticNameException:
+      value: {
+        "code": 1001,
+        "type": "IllegalStatisticNameException",
+        "message": "Custom statistic name must start with 'custom-'",
+        "stack": [
+          "org.apache.gravitino.exceptions.IllegalStatisticNameException: 
Custom statistic name must start with 'custom-'",
+          "..."
+        ]
+      }
+
+    UnmodifiableStatisticException:
+      value: {
+        "code": 1006,
+        "type": "UnmodifiableStatisticException",
+        "message": "Statistic is unmodifiable",
+        "stack": [
+          "org.apache.gravitino.exceptions.UnmodifiableStatisticException: 
Statistic is unmodifiable",
+          "..."
+        ]
+      }

Reply via email to