Skip to content

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

42.0 KB
Raw Blame
# 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}/catalogs/{catalog}/schemas/{schema}/tables:
    parameters:
      - $ref: "./openapi.yaml#/components/parameters/metalake"
      - $ref: "./openapi.yaml#/components/parameters/catalog"
      - $ref: "./openapi.yaml#/components/parameters/schema"

    get:
      tags:
        - table
      summary: List tables
      operationId: listTables
      responses:
        "200":
          $ref: "./openapi.yaml#/components/responses/EntityListResponse"
        "400":
          $ref: "./openapi.yaml#/components/responses/BadRequestErrorResponse"
        "403":
          $ref: "./openapi.yaml#/components/responses/ForbiddenErrorResponse"
        "406":
          $ref: "./openapi.yaml#/components/responses/NotAcceptableErrorResponse"
        "501":
          $ref: "#/components/responses/TableUnsupportedOperationErrorResponse"
        "5XX":
          $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"

    post:
      tags:
        - table
      summary: Create table
      operationId: createTable
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TableCreateRequest"
            examples:
              HiveTableCreate:
                $ref: "#/components/examples/HiveTableCreate"
              MysqlTableCreate:
                $ref: "#/components/examples/MysqlTableCreate"
              PostgresqlTableCreate:
                $ref: "#/components/examples/PostgresqlTableCreate"
              IcebergTableCreate:
                $ref: "#/components/examples/IcebergTableCreate"
              IcebergVariantTableCreate:
                $ref: "#/components/examples/IcebergVariantTableCreate"
      responses:
        "200":
          $ref: "#/components/responses/TableResponse"
        "403":
          $ref: "./openapi.yaml#/components/responses/ForbiddenErrorResponse"
        "406":
          $ref: "./openapi.yaml#/components/responses/NotAcceptableErrorResponse"
        "409":
          description: Conflict - The target table already exists
          content:
            application/vnd.gravitino.v1+json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
              examples:
                TableAlreadyExistsErrorResponse:
                  $ref: "#/components/examples/TableAlreadyExistsException"
        "501":
          $ref: "#/components/responses/TableUnsupportedOperationErrorResponse"
        "5XX":
          $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"


  /metalakes/{metalake}/catalogs/{catalog}/schemas/{schema}/tables/{table}:
    parameters:
      - $ref: "./openapi.yaml#/components/parameters/metalake"
      - $ref: "./openapi.yaml#/components/parameters/catalog"
      - $ref: "./openapi.yaml#/components/parameters/schema"
      - $ref: "./openapi.yaml#/components/parameters/table"

    get:
      tags:
        - table
      summary: Get table
      operationId: loadTable
      description: Returns the specified table object
      responses:
        "200":
          $ref: "#/components/responses/TableResponse"
        "403":
          $ref: "./openapi.yaml#/components/responses/ForbiddenErrorResponse"
        "404":
          description: >-
            Not Found - The table or its parent resource does not exist. When authorization
            is enabled, a missing metalake returns 403 instead.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
              examples:
                NoSuchMetalakeException:
                  $ref: "./metalakes.yaml#/components/examples/NoSuchMetalakeException"
                NoSuchCatalogException:
                  $ref: "./catalogs.yaml#/components/examples/NoSuchCatalogException"
                NoSuchSchemaException:
                  $ref: "./schemas.yaml#/components/examples/NoSuchSchemaException"
                NoSuchTableException:
                  $ref: "#/components/examples/NoSuchTableException"
        "406":
          $ref: "./openapi.yaml#/components/responses/NotAcceptableErrorResponse"
        "501":
          $ref: "#/components/responses/TableUnsupportedOperationErrorResponse"
        "5XX":
          $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"

    put:
      tags:
        - table
      summary: Update table
      operationId: alterTable
      description: Updates the specified table in a schema
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TableUpdatesRequest"
      responses:
        "200":
          $ref: "#/components/responses/TableResponse"
        "400":
          $ref: "./openapi.yaml#/components/responses/BadRequestErrorResponse"
        "403":
          $ref: "./openapi.yaml#/components/responses/ForbiddenErrorResponse"
        "404":
          description: >-
            Not Found - The table or its parent resource does not exist. When authorization
            is enabled, a missing metalake returns 403 instead.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
              examples:
                NoSuchMetalakeException:
                  $ref: "./metalakes.yaml#/components/examples/NoSuchMetalakeException"
                NoSuchCatalogException:
                  $ref: "./catalogs.yaml#/components/examples/NoSuchCatalogException"
                NoSuchSchemaException:
                  $ref: "./schemas.yaml#/components/examples/NoSuchSchemaException"
                NoSuchTableException:
                  $ref: "#/components/examples/NoSuchTableException"
        "406":
          $ref: "./openapi.yaml#/components/responses/NotAcceptableErrorResponse"
        "409":
          description: Conflict - The target table already exists
          content:
            application/vnd.gravitino.v1+json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
              examples:
                TableAlreadyExistsErrorResponse:
                  $ref: "#/components/examples/TableAlreadyExistsException"
        "501":
          $ref: "#/components/responses/TableUnsupportedOperationErrorResponse"
        "5XX":
          $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"

    delete:
      tags:
        - table
      summary: Drop table
      operationId: dropTable
      parameters:
        - $ref: "#/components/parameters/purge"
      responses:
        "200":
          $ref: "./openapi.yaml#/components/responses/DropResponse"
        "400":
          $ref: "./openapi.yaml#/components/responses/BadRequestErrorResponse"
        "403":
          $ref: "./openapi.yaml#/components/responses/ForbiddenErrorResponse"
        "406":
          $ref: "./openapi.yaml#/components/responses/NotAcceptableErrorResponse"
        "501":
          $ref: "#/components/responses/TableUnsupportedOperationErrorResponse"
        "5XX":
          $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"


components:
  parameters:
    purge:
      name: purge
      in: query
      description: Removes both the metadata and the directory associated with the table completely and skipping trash.
      required: false
      schema:
        type: boolean
        default: false

  schemas:
    TableCreateRequest:
      type: object
      required:
        - name
        - columns
      properties:
        name:
          type: string
          description: The name of the table
        columns:
          type: array
          description: A list of columns
          items:
            $ref: "#/components/schemas/WritableColumn"
        comment:
          type: string
          description: The comment of the table
          nullable: true
        properties:
          type: object
          description: A map of table properties
          nullable: true
          default: { }
          additionalProperties:
            type: string
        sortOrders:
          type: array
          description: Describes the sort order of the table data
          nullable: true
          default: [ ]
          items:
            $ref: "#/components/schemas/WritableSortOrder"
        distribution:
          $ref: "#/components/schemas/WritableDistribution"
        partitioning:
          type: array
          description: partitioning of the table data
          nullable: true
          default: [ ]
          items:
            $ref: "./partitioning.yaml#/components/schemas/WritablePartitioningSpec"
        indexes:
          type: array
          description: Indexes of the table
          nullable: true
          default: [ ]
          items:
            $ref: "./indexes.yaml#/components/schemas/IndexSpec"

      example:
        name: events
        columns:
          - name: id
            type: integer
            defaultValue:
              type: literal
              dataType: integer
              value: null
          - name: created_at
            type: timestamp
            defaultValue:
              type: unparsed
              unparsedExpression: CURRENT_TIMESTAMP
        distribution: null

    Table:
      type: object
      description: A table object
      required:
        - name
        - columns
        - audit
      properties:
        name:
          type: string
          description: The name of the table
        columns:
          type: array
          description: A list of columns
          items:
            $ref: "#/components/schemas/Column"
        comment:
          type: string
          description: The comment of the table
          nullable: true
        audit:
          $ref: "./openapi.yaml#/components/schemas/Audit"
        properties:
          type: object
          description: A map of table properties
          nullable: true
          default: { }
          additionalProperties:
            type: string
        distribution:
          $ref: "#/components/schemas/Distribution"
        sortOrders:
          type: array
          description: Describes the sort order of the table data
          nullable: true
          default: [ ]
          items:
            $ref: "#/components/schemas/SortOrder"
        partitioning:
          type: array
          description: partitioning of the table data
          nullable: true
          default: [ ]
          items:
            $ref: "./partitioning.yaml#/components/schemas/PartitioningSpec"
        indexes:
          type: array
          description: Indexes of the table
          nullable: true
          default: [ ]
          items:
            $ref: "./indexes.yaml#/components/schemas/IndexSpec"

    Distribution:
      type: object
      description: Describes how data is distributed across partitions
      nullable: true
      required:
        - number
        - funcArgs
      properties:
        strategy:
          type: string
          description: The distribution strategy
          nullable: true
          default: "hash"
          enum:
            - "hash"
            - "range"
            - "even"
        number:
          type: integer
          description: The number of buckets/distribution
          format: int32
        funcArgs:
          type: array
          description: The arguments of the distribution function
          nullable: true
          default: [ ]
          items:
            $ref: "./expression.yaml#/components/schemas/FunctionArg"

    SortOrder:
      type: object
      required:
        - sortTerm
      properties:
        sortTerm:
          $ref: "./expression.yaml#/components/schemas/FunctionArg"
        direction:
          type: string
          description: The direction of the sort order
          enum:
            - "asc"
            - "desc"
          nullable: true
          default: "asc"
        nullOrdering:
          type: string
          description: |
            The sort order of null values.
            The default value is "nulls_first" if the direction is "asc", otherwise "nulls_last".
          enum:
            - "nulls_first"
            - "nulls_last"

    FieldNames:
      type: array
      description: The names of the fields, each field may be with multiple levels
      items:
        $ref: "#/components/schemas/FieldName"

    FieldName:
      type: array
      description: The name of the field, may be with multiple levels
      items:
        type: string

    ColumnDefaultValue:
      allOf:
        - $ref: "./expression.yaml#/components/schemas/FunctionArg"
      description: >
        A column default expression. See Column.defaultValue and
        Column.initialDefaultValue for the two public meanings.

    Column:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          description: The name of the column
        type:
          $ref: "./datatype.yaml#/components/schemas/DataType"
        comment:
          type: string
          description: The comment of the column
          nullable: true
        nullable:
          type: boolean
          description: Whether the column is nullable
          nullable: true
          default: true
        defaultValue:
          allOf:
            - $ref: "#/components/schemas/ColumnDefaultValue"
          description: >
            Default used for new records that omit this column. Unset when the
            catalog does not support column defaults. For example, for Iceberg
            format-version 3 this maps to write-default.
        initialDefaultValue:
          allOf:
            - $ref: "#/components/schemas/ColumnDefaultValue"
          description: >
            Default used when reading stored records that lack this column, such
            as records written before the column was added. Unset when the catalog
            does not distinguish an initial default. Setting this through create
            or alter is not supported yet; it is exposed on load when the catalog
            provides it. For example, for Iceberg format-version 3 this maps to
            initial-default.
        autoIncrement:
          type: boolean
          description: Whether the column is auto increment
          nullable: true
          default: false

    WritableColumn:
      allOf:
        - $ref: "#/components/schemas/Column"
        - type: object
          properties:
            type:
              $ref: "./datatype.yaml#/components/schemas/WritableDataType"
            defaultValue:
              $ref: "#/components/schemas/WritableColumnDefaultValue"

    WritableColumnDefaultValue:
      allOf:
        - $ref: "./expression.yaml#/components/schemas/WritableFunctionArg"
      description: The default value of a new or updated column, with writable literal types

    WritableDistribution:
      allOf:
        - $ref: "#/components/schemas/Distribution"
        - type: object
          nullable: true
          properties:
            funcArgs:
              type: array
              nullable: true
              items:
                $ref: "./expression.yaml#/components/schemas/WritableFunctionArg"

      example:
        strategy: even
        number: 0
        funcArgs: null

    WritableSortOrder:
      allOf:
        - $ref: "#/components/schemas/SortOrder"
        - type: object
          properties:
            sortTerm:
              $ref: "./expression.yaml#/components/schemas/WritableFunctionArg"

    TableUpdatesRequest:
      type: object
      required:
        - updates
      properties:
        updates:
          type: array
          items:
            $ref: "#/components/schemas/TableUpdateRequest"

    TableUpdateRequest:
      oneOf:
        - $ref: "#/components/schemas/RenameTableRequest"
        - $ref: "#/components/schemas/UpdateTableCommentRequest"
        - $ref: "#/components/schemas/SetTablePropertyRequest"
        - $ref: "#/components/schemas/RemoveTablePropertyRequest"
        - $ref: "#/components/schemas/AddTableColumnRequest"
        - $ref: "#/components/schemas/RenameTableColumnRequest"
        - $ref: "#/components/schemas/UpdateTableColumnTypeRequest"
        - $ref: "#/components/schemas/UpdateTableColumnCommentRequest"
        - $ref: "#/components/schemas/UpdateTableColumnPositionRequest"
        - $ref: "#/components/schemas/UpdateTableColumnNullabilityRequest"
        - $ref: "#/components/schemas/UpdateTableColumnDefaultValueRequest"
        - $ref: "#/components/schemas/DeleteTableColumnRequest"
        - $ref: "#/components/schemas/AddTableIndexRequest"
        - $ref: "#/components/schemas/DeleteTableIndexRequest"
      discriminator:
        propertyName: "@type"
        mapping:
          rename: "#/components/schemas/RenameTableRequest"
          updateComment: "#/components/schemas/UpdateTableCommentRequest"
          setProperty: "#/components/schemas/SetTablePropertyRequest"
          removeProperty: "#/components/schemas/RemoveTablePropertyRequest"
          addColumn: "#/components/schemas/AddTableColumnRequest"
          renameColumn: "#/components/schemas/RenameTableColumnRequest"
          updateColumnType: "#/components/schemas/UpdateTableColumnTypeRequest"
          updateColumnComment: "#/components/schemas/UpdateTableColumnCommentRequest"
          updateColumnPosition: "#/components/schemas/UpdateTableColumnPositionRequest"
          updateColumnNullability: "#/components/schemas/UpdateTableColumnNullabilityRequest"
          updateColumnDefaultValue: "#/components/schemas/UpdateTableColumnDefaultValueRequest"
          deleteColumn: "#/components/schemas/DeleteTableColumnRequest"
          addTableIndex: "#/components/schemas/AddTableIndexRequest"
          deleteTableIndex: "#/components/schemas/DeleteTableIndexRequest"

    RenameTableRequest:
      type: object
      required:
        - "@type"
        - newName
      properties:
        "@type":
          type: string
          enum:
            - "rename"
        newName:
          type: string
          description: The new name of the table
        newSchemaName:
          type: string
          description: The new schema name of the table, if not provided, the schema will not be changed
          nullable: true
      example: {
        "@type": "rename",
        "newName": "my_hive_table_new",
        "newSchemaName": "my_hive_schema_new"
      }

    UpdateTableCommentRequest:
      type: object
      required:
        - "@type"
        - newComment
      properties:
        "@type":
          type: string
          enum:
            - "updateComment"
        newComment:
          type: string
          description: The new comment of the table
      example: {
        "@type": "updateComment",
        "newComment": "This is my Hive table new comment"
      }

    SetTablePropertyRequest:
      type: object
      required:
        - "@type"
        - property
        - value
      properties:
        "@type":
          type: string
          enum:
            - "setProperty"
        property:
          type: string
          description: The name of the property to set
        value:
          type: string
          description: The value of the property to set
      example: {
        "@type": "setProperty",
        "property": "key1",
        "value": "value1_new"
      }

    RemoveTablePropertyRequest:
      type: object
      required:
        - "@type"
        - property
      properties:
        "@type":
          type: string
          enum:
            - "removeProperty"
        property:
          type: string
          description: The name of the property to remove
      example: {
        "@type": "removeProperty",
        "property": "key2"
      }

    AddTableColumnRequest:
      type: object
      required:
        - "@type"
        - fieldName
        - type
      properties:
        "@type":
          type: string
          enum:
            - "addColumn"
        fieldName:
          $ref: "#/components/schemas/FieldName"
          description: The name of the column to add
        type:
          $ref: "./datatype.yaml#/components/schemas/WritableDataType"
          description: The type of the column to add
        comment:
          type: string
          description: The comment of the column to add
          nullable: true
        position:
          allOf:
            - $ref: "#/components/schemas/ColumnPosition"
          description: The position of the column to add
        nullable:
          type: boolean
          description: Whether the column to add is nullable
          nullable: true
          default: true
        autoIncrement:
          type: boolean
          description: Whether the column to add should auto increment
          nullable: true
          default: false
        defaultValue:
          allOf:
            - $ref: "#/components/schemas/WritableColumnDefaultValue"
          description: The default value of the column to add
      example: {
        "@type": "addColumn",
        "fieldName": [ "new_column" ],
        "type": "integer",
        "comment": "new integer column comment",
        "position": "first",
        "nullable": true,
        "autoIncrement": false,
        "defaultValue" : {
          "type": "literal",
          "dataType": "integer",
          "value": "1024"
        }
      }

    RenameTableColumnRequest:
      type: object
      required:
        - "@type"
        - oldFieldName
        - newFieldName
      properties:
        "@type":
          type: string
          enum:
            - "renameColumn"
        oldFieldName:
          $ref: "#/components/schemas/FieldName"
          description: The name of the column to rename
        newFieldName:
          type: string
          description: The new name of the field
      example: {
        "@type": "renameColumn",
        "oldFieldName": [ "existing_column" ],
        "newFieldName": "existing_column_new"
      }

    UpdateTableColumnTypeRequest:
      type: object
      required:
        - "@type"
        - fieldName
        - newType
      properties:
        "@type":
          type: string
          enum:
            - "updateColumnType"
        fieldName:
          $ref: "#/components/schemas/FieldName"
          description: The name of the column to update
        newType:
          $ref: "./datatype.yaml#/components/schemas/WritableDataType"
          description: The new type of the column
      example: {
        "@type": "updateColumnType",
        "fieldName": [ "existing_column" ],
        "newType": "string"
      }

    UpdateTableColumnCommentRequest:
      type: object
      required:
        - "@type"
        - fieldName
        - newComment
      properties:
        "@type":
          type: string
          enum:
            - "updateColumnComment"
        fieldName:
          $ref: "#/components/schemas/FieldName"
          description: The name of the column to update
        newComment:
          type: string
          description: The new comment of the column
      example: {
        "@type": "updateColumnComment",
        "fieldName": [ "existing_column" ],
        "newComment": "existing column new comment"
      }

    UpdateTableColumnPositionRequest:
      type: object
      required:
        - "@type"
        - fieldName
        - newPosition
      properties:
        "@type":
          type: string
          enum:
            - "updateColumnPosition"
        fieldName:
          $ref: "#/components/schemas/FieldName"
          description: The name of the column to update
        newPosition:
          $ref: "#/components/schemas/ColumnPosition"
          description: The new position of the column
      example: {
        "@type": "updateColumnPosition",
        "fieldName": [ "existing_column" ],
        "newPosition": {
          "after": "existing_column"
        }
      }

    UpdateTableColumnNullabilityRequest:
      type: object
      required:
        - "@type"
        - fieldName
        - nullable
      properties:
        "@type":
          type: string
          enum:
            - "updateColumnNullability"
        fieldName:
          $ref: "#/components/schemas/FieldName"
          description: The name of the column to update
        nullable:
          type: boolean
          description: Whether the column is nullable
      example: {
        "@type": "updateColumnNullability",
        "fieldName": [ "existing_column" ],
        "nullable": true
      }

    UpdateTableColumnDefaultValueRequest:
      type: object
      required:
        - "@type"
        - fieldName
        - newDefaultValue
      properties:
        "@type":
          type: string
          enum:
            - "updateColumnDefaultValue"
        fieldName:
          $ref: "#/components/schemas/FieldName"
          description: The name of the column to update
        newDefaultValue:
          $ref: "#/components/schemas/WritableColumnDefaultValue"
          description: The new default value of the column 
      example: {
        "@type": "updateColumnDefaultValue",
        "fieldName": [ "existing_column" ],
        "newDefaultValue": { "type": "literal", "dataType": "varchar(100)", "value": "new default value" }
      }

    DeleteTableColumnRequest:
      type: object
      required:
        - "@type"
        - fieldName
      properties:
        "@type":
          type: string
          enum:
            - "deleteColumn"
        fieldName:
          $ref: "#/components/schemas/FieldName"
          description: The name of the column to delete
        ifExists:
          type: boolean
          description: If true, the request will not fail if the column does not exist
          nullable: true
          default: false
      example: {
        "@type": "deleteColumn",
        "fieldName": [ "no_existing_column" ],
        "ifExists": true
      }

    AddTableIndexRequest:
      type: object
      required:
        - "@type"
        - index
      properties:
        "@type":
          type: string
          enum:
            - "addTableIndex"
        index:
          $ref: "./indexes.yaml#/components/schemas/IndexSpec"
      example:
        "@type": addTableIndex
        index:
          indexType: UNIQUE_KEY
          name: email_uk
          fieldNames: [[email]]

    DeleteTableIndexRequest:
      type: object
      required:
        - "@type"
        - name
      properties:
        "@type":
          type: string
          enum:
            - "deleteTableIndex"
        name:
          type: string
          description: The name of the index to delete
        ifExists:
          type: boolean
          description: If true, ignore a missing index
          default: false
      example:
        "@type": deleteTableIndex
        name: email_uk
        ifExists: true

    ColumnPosition:
      oneOf:
        - $ref: "#/components/schemas/FirstColumnPosition"
        - $ref: "#/components/schemas/AfterColumnPosition"
        - $ref: "#/components/schemas/DefaultColumnPosition"

    FirstColumnPosition:
      type: string
      enum:
        - "first"

    AfterColumnPosition:
      type: object
      required:
        - after
      properties:
        after:
          type: string
          description: The name of the column which the new column will be added after

    DefaultColumnPosition:
      type: string
      description: |
        The default position of the column to add, the position is determined by the catalog implementation
      enum:
        - "default"


  responses:
    TableUnsupportedOperationErrorResponse:
      description: Not Implemented - The catalog does not support table operations or the requested table operation
      content:
        application/json:
          schema:
            $ref: "./openapi.yaml#/components/schemas/ErrorModel"
          example:
            code: 1006
            type: UnsupportedOperationException
            message: Catalog does not support table operations

    TableResponse:
      description: Returns include the table object
      content:
        application/vnd.gravitino.v1+json:
          schema:
            type: object
            properties:
              code:
                type: integer
                format: int32
                description: Status code of the response
                enum:
                  - 0
              table:
                $ref: "#/components/schemas/Table"
          examples:
            TableResponse:
              $ref: "#/components/examples/TableResponse"
            MysqlTableResponse:
              $ref: "#/components/examples/MysqlTableResponse"
            PostgresqlTableResponse:
              $ref: "#/components/examples/PostgresqlTableResponse"

  examples:
    TableListResponse:
      value: {
        "code": 0,
        "identifiers": [
          {
            "namespace": [
              "my_metalake",
              "my_hive_catalog",
              "my_hive_schema"
            ],
            "name": "my_hive_table"
          }
        ]
      }

    HiveTableCreate:
      value: {
        "name": "my_hive_table",
        "comment": "This is my Hive table",
        "columns": [
          {
            "name": "id",
            "type": "integer",
            "comment": "id column comment",
            "nullable": true,
            "autoIncrement": false
          },
          {
            "name": "name",
            "type": "string",
            "comment": "name column comment",
            "nullable": true
          },
          {
            "name": "age",
            "type": "integer",
            "comment": "age column comment",
            "nullable": true
          },
          {
            "name": "info",
            "type": {
              "type": "struct",
              "fields": [
                {
                  "name": "position",
                  "type": "string",
                  "nullable": true
                },
                {
                  "name": "contact",
                  "type": {
                    "type": "list",
                    "elementType": "integer",
                    "containsNull": true
                  },
                  "nullable": true
                },
                {
                  "name": "rating",
                  "type": {
                    "type": "map",
                    "keyType": "string",
                    "valueType": "integer",
                    "valueContainsNull": true
                  },
                  "nullable": true
                }
              ]
            },
            "comment": "info column comment",
            "nullable": true
          },
          {
            "name": "dt",
            "type": "date",
            "comment": "dt column comment",
            "nullable": true
          }
        ],
        "partitioning": [
          {
            "strategy": "identity",
            "fieldName": [ "dt" ]
          }
        ],
        "distribution": {
          "strategy": "hash",
          "number": 32,
          "funcArgs": [
            {
              "type": "field",
              "fieldName": [ "id" ]
            }
          ]
        },
        "sortOrders": [
          {
            "sortTerm": {
              "type": "field",
              "fieldName": [ "age" ]
            },
            "direction": "asc",
            "nullOrdering": "nulls_first"
          }
        ],
        "properties": {
          "format": "ORC"
        },
        "indexes": [ ]
      }

    MysqlTableCreate:
      value: {
        "name": "my_mysql_table",
        "comment": "This is my MySQL table",
        "columns": [
          {
            "name": "id",
            "type": "integer",
            "comment": "id column comment",
            "nullable": false,
            "autoIncrement": true
          },
          {
            "name": "name",
            "type": "varchar(255)",
            "comment": "name column comment",
            "nullable": true,
            "defaultValue": {
              "type": "literal",
              "dataType": "varchar(255)",
              "value": "default_name"
            }
          },
          {
            "name": "age",
            "type": "integer",
            "comment": "age column comment",
            "nullable": true
          },
          {
            "name": "dt",
            "type": "date",
            "comment": "dt column comment",
            "nullable": true
          }
        ],
        "indexes": [
          {
            "indexType": "PRIMARY_KEY",
            "name": "PRIMARY",
            "fieldNames": [["id"]]
          },
          {
            "indexType": "UNIQUE_KEY",
            "name": "uk_1",
            "fieldNames": [["name"]]
          },
          {
            "indexType": "UNIQUE_KEY",
            "name": "uk_2",
            "fieldNames": [["name"] ,["age"] ,["dt"]]
          }
        ],
        "properties": {
          "engine": "InnoDB",
          "auto-increment-offset": "1"
        }
      }

    PostgresqlTableCreate:
      value: {
        "name": "my_postgresql_table",
        "comment": "This is my PostgreSQL table",
        "columns": [
          {
            "name": "id",
            "type": "integer",
            "comment": "id column comment",
            "nullable": false,
            "autoIncrement": true
          },
          {
            "name": "name",
            "type": "string",
            "comment": "name column comment",
            "nullable": true
          },
          {
            "name": "age",
            "type": "integer",
            "comment": "age column comment",
            "nullable": true
          },
          {
            "name": "dt",
            "type": "date",
            "comment": "dt column comment",
            "nullable": true
          }
        ],
        "indexes": [
          {
            "indexType": "PRIMARY_KEY",
            "name": "PRIMARY",
            "fieldNames": [["id"]]
          },
          {
            "indexType": "UNIQUE_KEY",
            "name": "uk_1",
            "fieldNames": [["name"]]
          },
          {
            "indexType": "UNIQUE_KEY",
            "name": "uk_2",
            "fieldNames": [["name"] ,["age"] ,["dt"]]
          }
        ],
        "properties": { }
      }

    IcebergTableCreate:
      value: {
        "name": "my_iceberg_table",
        "comment": "This is my Iceberg table",
        "columns": [
          {
            "name": "id",
            "type": "integer",
            "comment": "id column comment",
            "nullable": false
          },
          {
            "name": "name",
            "type": "string",
            "comment": "name column comment",
            "nullable": true
          }
        ],
        "properties": {
          "format-version": "2"
        },
        indexes: [ ]
      }

    IcebergVariantTableCreate:
      value: {
        "name": "my_iceberg_variant_table",
        "comment": "Iceberg table with a variant column, which requires format-version 3",
        "columns": [
          {
            "name": "id",
            "type": "integer",
            "comment": "id column comment",
            "nullable": false
          },
          {
            "name": "payload",
            "type": "variant",
            "comment": "semi-structured payload column",
            "nullable": true
          }
        ],
        "properties": {
          "format-version": "3"
        },
        indexes: [ ]
      }

    TableResponse:
      value: {
        "code": 0,
        "table": {
          "name": "my_hive_table",
          "comment": "This is my Hive table",
          "columns": [
            {
              "name": "id",
              "type": "integer",
              "comment": "id column comment",
              "nullable": true,
              "autoIncrement": false
            },
            {
              "name": "name",
              "type": "string",
              "comment": "name column comment",
              "nullable": true
            },
            {
              "name": "age",
              "type": "integer",
              "comment": "age column comment",
              "nullable": true
            },
            {
              "name": "dt",
              "type": "date",
              "comment": "dt column comment",
              "nullable": true
            }
          ],
          "properties": {
            "input-format": "org.apache.hadoop.hive.ql.io.orc.OrcInputFormat",
            "transient_lastDdlTime": "1702033666",
            "output-format": "org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat",
            "location": "hdfs://0.0.0.0:9000/user/hive/warehouse/my_hive_table",
            "table-type": "MANAGED_TABLE",
            "serde-lib": "org.apache.hadoop.hive.ql.io.orc.OrcSerde",
            "serde-name": "my_hive_table"
          },
          "audit": {
            "creator": "gravitino",
            "createTime": "2023-12-08T11:07:46.938Z"
          },
          "distribution": {
            "strategy": "hash",
            "number": 32,
            "funcArgs": [
              {
                "type": "field",
                "fieldName": [
                  "id"
                ]
              }
            ]
          },
          "sortOrders": [
            {
              "sortTerm": {
                "type": "field",
                "fieldName": [
                  "age"
                ]
              },
              "direction": "asc",
              "nullOrdering": "nulls_first"
            }
          ],
          "partitioning": [
            {
              "strategy": "identity",
              "fieldName": [
                "dt"
              ]
            }
          ],
          "indexes": [ ]
        }
      }

    MysqlTableResponse:
      value: {
        "code": 0,
        "table": {
          "name": "my_mysql_table",
          "comment": "This is my MySQL table",
          "columns": [
            {
              "name": "id",
              "type": "integer",
              "comment": "id column comment",
              "nullable": true,
              "autoIncrement": true
            },
            {
              "name": "name",
              "type": "string",
              "comment": "name column comment",
              "nullable": true
            },
            {
              "name": "age",
              "type": "integer",
              "comment": "age column comment",
              "nullable": true
            },
            {
              "name": "dt",
              "type": "date",
              "comment": "dt column comment",
              "nullable": true
            }
          ],
          "properties": {
            "engine": "InnoDB",
            "auto-increment-offset": "1",
          },
          "audit": {
            "creator": "gravitino",
            "createTime": "2023-12-08T11:07:46.938Z"
          },
          "distribution": null,
          "sortOrders": [ ],
          "partitioning": [ ],
          "indexes": [
            {
              "indexType": "PRIMARY_KEY",
              "name": "PRIMARY",
              "fieldNames": [["id"]]
            },
            {
              "indexType": "UNIQUE_KEY",
              "name": "uk_1",
              "fieldNames": [["name"]]
            },
            {
              "indexType": "UNIQUE_KEY",
              "name": "uk_2",
              "fieldNames": [["name"] ,["age"] ,["dt"]]
            }
          ]
        }
      }

    PostgresqlTableResponse:
      value: {
        "code": 0,
        "table": {
          "name": "my_postgresql_table",
          "comment": "This is my PostgreSQL table",
          "columns": [
            {
              "name": "id",
              "type": "integer",
              "comment": "id column comment",
              "nullable": true,
              "autoIncrement": true
            },
            {
              "name": "name",
              "type": "string",
              "comment": "name column comment",
              "nullable": true
            },
            {
              "name": "age",
              "type": "integer",
              "comment": "age column comment",
              "nullable": true
            },
            {
              "name": "dt",
              "type": "date",
              "comment": "dt column comment",
              "nullable": true
            }
          ],
          "properties": { },
          "audit": {
            "creator": "gravitino",
            "createTime": "2023-12-08T11:07:46.938Z"
          },
          "distribution": null,
          "sortOrders": [ ],
          "partitioning": [ ],
          "indexes": [
            {
              "indexType": "PRIMARY_KEY",
              "name": "PRIMARY",
              "fieldNames": [["id"]]
            },
            {
              "indexType": "UNIQUE_KEY",
              "name": "uk_1",
              "fieldNames": [["name"]]
            },
            {
              "indexType": "UNIQUE_KEY",
              "name": "uk_2",
              "fieldNames": [["name"] ,["age"] ,["dt"]]
            }
          ]
        }
      }

    TableAlreadyExistsException:
      value: {
        "code": 1004,
        "type": "TableAlreadyExistsException",
        "message": "Failed to operate table(s) [my_hive_table] operation [CREATE] under schema [my_hive_schema], reason [TableAlreadyExistsException]",
        "stack": [
          "org.apache.gravitino.exceptions.TableAlreadyExistsException: Table already exists: my_hive_table",
          "..."
        ]
      }

    NoSuchTableException:
      value: {
        "code": 1003,
        "type": "NoSuchTableException",
        "message": "Failed to operate table(s) [test_table] operation [LOAD] under schema [test_schema], reason [NoSuchTableException]",
        "stack": [
          "org.apache.gravitino.exceptions.NoSuchTableException: Hive table does not exist: test_table in Hive Metastore",
          "..."
        ]
      }