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

etudenhoefner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/main by this push:
     new 5f577f1b99 OpenAPI: Spec updates for statistics (#9690)
5f577f1b99 is described below

commit 5f577f1b9902ffe6181897a439686a31fc81b89a
Author: Marc Cenac <[email protected]>
AuthorDate: Fri Feb 9 02:33:12 2024 -0600

    OpenAPI: Spec updates for statistics (#9690)
---
 open-api/rest-catalog-open-api.py   | 24 +++++++++++++++++
 open-api/rest-catalog-open-api.yaml | 54 +++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+)

diff --git a/open-api/rest-catalog-open-api.py 
b/open-api/rest-catalog-open-api.py
index c8889271b2..c193b53e94 100644
--- a/open-api/rest-catalog-open-api.py
+++ b/open-api/rest-catalog-open-api.py
@@ -347,6 +347,11 @@ class RemoveStatisticsUpdate(BaseUpdate):
     snapshot_id: int = Field(..., alias='snapshot-id')
 
 
+class RemovePartitionStatisticsUpdate(BaseUpdate):
+    action: Literal['remove-partition-statistics']
+    snapshot_id: int = Field(..., alias='snapshot-id')
+
+
 class TableRequirement(BaseModel):
     type: str
 
@@ -618,6 +623,12 @@ class BlobMetadata(BaseModel):
     properties: Optional[Dict[str, Any]] = None
 
 
+class PartitionStatisticsFile(BaseModel):
+    snapshot_id: int = Field(..., alias='snapshot-id')
+    statistics_path: str = Field(..., alias='statistics-path')
+    file_size_in_bytes: int = Field(..., alias='file-size-in-bytes')
+
+
 class CreateNamespaceRequest(BaseModel):
     namespace: Namespace
     properties: Optional[Dict[str, str]] = Field(
@@ -638,6 +649,13 @@ class TransformTerm(BaseModel):
     term: Reference
 
 
+class SetPartitionStatisticsUpdate(BaseUpdate):
+    action: Literal['set-partition-statistics']
+    partition_statistics: PartitionStatisticsFile = Field(
+        ..., alias='partition-statistics'
+    )
+
+
 class ReportMetricsRequest2(CommitReport):
     report_type: str = Field(..., alias='report-type')
 
@@ -754,6 +772,12 @@ class TableMetadata(BaseModel):
     last_sequence_number: Optional[int] = Field(None, 
alias='last-sequence-number')
     snapshot_log: Optional[SnapshotLog] = Field(None, alias='snapshot-log')
     metadata_log: Optional[MetadataLog] = Field(None, alias='metadata-log')
+    statistics_files: Optional[List[StatisticsFile]] = Field(
+        None, alias='statistics-files'
+    )
+    partition_statistics_files: Optional[List[PartitionStatisticsFile]] = 
Field(
+        None, alias='partition-statistics-files'
+    )
 
 
 class ViewMetadata(BaseModel):
diff --git a/open-api/rest-catalog-open-api.yaml 
b/open-api/rest-catalog-open-api.yaml
index 1048425147..e1d3c7df22 100644
--- a/open-api/rest-catalog-open-api.yaml
+++ b/open-api/rest-catalog-open-api.yaml
@@ -2058,6 +2058,15 @@ components:
           $ref: '#/components/schemas/SnapshotLog'
         metadata-log:
           $ref: '#/components/schemas/MetadataLog'
+        # statistics
+        statistics-files:
+          type: array
+          items:
+            $ref: '#/components/schemas/StatisticsFile'
+        partition-statistics-files:
+          type: array
+          items:
+            $ref: '#/components/schemas/PartitionStatisticsFile'
 
     SQLViewRepresentation:
       type: object
@@ -2181,6 +2190,8 @@ components:
           set-current-view-version: 
'#/components/schemas/SetCurrentViewVersionUpdate'
           set-statistics: '#/components/schemas/SetStatisticsUpdate'
           remove-statistics: '#/components/schemas/RemoveStatisticsUpdate'
+          set-partition-statistics: 
'#/components/schemas/SetPartitionStatisticsUpdate'
+          remove-partition-statistics: 
'#/components/schemas/RemovePartitionStatisticsUpdate'
       type: object
       required:
         - action
@@ -2456,6 +2467,33 @@ components:
           type: integer
           format: int64
 
+    SetPartitionStatisticsUpdate:
+      allOf:
+        - $ref: '#/components/schemas/BaseUpdate'
+      required:
+        - action
+        - partition-statistics
+      properties:
+        action:
+          type: string
+          enum: [ "set-partition-statistics" ]
+        partition-statistics:
+          $ref: '#/components/schemas/PartitionStatisticsFile'
+
+    RemovePartitionStatisticsUpdate:
+      allOf:
+        - $ref: '#/components/schemas/BaseUpdate'
+      required:
+        - action
+        - snapshot-id
+      properties:
+        action:
+          type: string
+          enum: [ "remove-partition-statistics" ]
+        snapshot-id:
+          type: integer
+          format: int64
+
     TableUpdate:
       anyOf:
         - $ref: '#/components/schemas/AssignUUIDUpdate'
@@ -3270,6 +3308,22 @@ components:
         properties:
           type: object
 
+    PartitionStatisticsFile:
+      type: object
+      required:
+        - snapshot-id
+        - statistics-path
+        - file-size-in-bytes
+      properties:
+        snapshot-id:
+          type: integer
+          format: int64
+        statistics-path:
+          type: string
+        file-size-in-bytes:
+          type: integer
+          format: int64
+
 
   #############################
   # Reusable Response Objects #

Reply via email to