Skip to content

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

7.7 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.

---

components:
  schemas:
    PartitioningSpec:
      oneOf:
        - $ref: "#/components/schemas/IdentityPartitioning"
        - $ref: "#/components/schemas/YearPartitioning"
        - $ref: "#/components/schemas/MonthPartitioning"
        - $ref: "#/components/schemas/DayPartitioning"
        - $ref: "#/components/schemas/HourPartitioning"
        - $ref: "#/components/schemas/BucketPartitioning"
        - $ref: "#/components/schemas/TruncatePartitioning"
        - $ref: "#/components/schemas/ListPartitioning"
        - $ref: "#/components/schemas/RangePartitioning"
        - $ref: "#/components/schemas/FunctionPartitioning"
      discriminator:
        propertyName: strategy
        mapping:
          identity: "#/components/schemas/IdentityPartitioning"
          year: "#/components/schemas/YearPartitioning"
          month: "#/components/schemas/MonthPartitioning"
          day: "#/components/schemas/DayPartitioning"
          hour: "#/components/schemas/HourPartitioning"
          bucket: "#/components/schemas/BucketPartitioning"
          truncate: "#/components/schemas/TruncatePartitioning"
          list: "#/components/schemas/ListPartitioning"
          range: "#/components/schemas/RangePartitioning"
          function: "#/components/schemas/FunctionPartitioning"

    IdentityPartitioning:
      type: object
      required:
        - strategy
        - fieldName
      properties:
        strategy:
          type: string
          enum:
            - "identity"
        fieldName:
          $ref: "./tables.yaml#/components/schemas/FieldName"

    YearPartitioning:
      type: object
      required:
        - strategy
        - fieldName
      properties:
        strategy:
          type: string
          enum:
            - "year"
        fieldName:
          $ref: "./tables.yaml#/components/schemas/FieldName"

    MonthPartitioning:
      type: object
      required:
        - strategy
        - fieldName
      properties:
        strategy:
          type: string
          enum:
            - "month"
        fieldName:
          $ref: "./tables.yaml#/components/schemas/FieldName"

    DayPartitioning:
      type: object
      required:
        - strategy
        - fieldName
      properties:
        strategy:
          type: string
          enum:
            - "day"
        fieldName:
          $ref: "./tables.yaml#/components/schemas/FieldName"

    HourPartitioning:
      type: object
      required:
        - strategy
        - fieldName
      properties:
        strategy:
          type: string
          enum:
            - "hour"
        fieldName:
          $ref: "./tables.yaml#/components/schemas/FieldName"

    BucketPartitioning:
      type: object
      required:
        - strategy
        - numBuckets
        - fieldNames
      properties:
        strategy:
          type: string
          enum:
            - "bucket"
        numBuckets:
          type: integer
          description: The number of buckets
        fieldNames:
          $ref: "./tables.yaml#/components/schemas/FieldNames"

    TruncatePartitioning:
      type: object
      required:
        - strategy
        - width
        - fieldName
      properties:
        strategy:
          type: string
          enum:
            - "truncate"
        width:
          type: integer
          description: The width of the truncate
        fieldName:
          $ref: "./tables.yaml#/components/schemas/FieldName"

    ListPartitioning:
      type: object
      required:
        - strategy
        - fieldNames
      properties:
        strategy:
          type: string
          enum:
            - "list"
        fieldNames:
          $ref: "./tables.yaml#/components/schemas/FieldNames"
        assignments:
          type: array
          description: The pre-assigned list partitions
          items:
            $ref: "./partitions.yaml#/components/schemas/ListPartition"

    RangePartitioning:
      type: object
      required:
        - strategy
        - fieldName
      properties:
        strategy:
          type: string
          enum:
            - "range"
        fieldName:
          $ref: "./tables.yaml#/components/schemas/FieldName"
        assignments:
          type: array
          description: The pre-assigned range partitions
          items:
            $ref: "./partitions.yaml#/components/schemas/RangePartition"

    FunctionPartitioning:
      type: object
      required:
        - strategy
        - funcName
        - funcArgs
      properties:
        strategy:
          type: string
          enum:
            - "function"
        funcName:
          type: string
          description: The name of the partitioning function
        funcArgs:
          type: array
          description: The arguments of the partitioning function
          items:
            $ref: "./expression.yaml#/components/schemas/FunctionArg"

    WritablePartitioningSpec:
      oneOf:
        - $ref: "#/components/schemas/IdentityPartitioning"
        - $ref: "#/components/schemas/YearPartitioning"
        - $ref: "#/components/schemas/MonthPartitioning"
        - $ref: "#/components/schemas/DayPartitioning"
        - $ref: "#/components/schemas/HourPartitioning"
        - $ref: "#/components/schemas/BucketPartitioning"
        - $ref: "#/components/schemas/TruncatePartitioning"
        - $ref: "#/components/schemas/WritableListPartitioning"
        - $ref: "#/components/schemas/WritableRangePartitioning"
        - $ref: "#/components/schemas/WritableFunctionPartitioning"
      discriminator:
        propertyName: strategy
        mapping:
          identity: "#/components/schemas/IdentityPartitioning"
          year: "#/components/schemas/YearPartitioning"
          month: "#/components/schemas/MonthPartitioning"
          day: "#/components/schemas/DayPartitioning"
          hour: "#/components/schemas/HourPartitioning"
          bucket: "#/components/schemas/BucketPartitioning"
          truncate: "#/components/schemas/TruncatePartitioning"
          list: "#/components/schemas/WritableListPartitioning"
          range: "#/components/schemas/WritableRangePartitioning"
          function: "#/components/schemas/WritableFunctionPartitioning"

    WritableListPartitioning:
      allOf:
        - $ref: "#/components/schemas/ListPartitioning"
        - type: object
          properties:
            assignments:
              type: array
              items:
                $ref: "./partitions.yaml#/components/schemas/WritableListPartition"

    WritableRangePartitioning:
      allOf:
        - $ref: "#/components/schemas/RangePartitioning"
        - type: object
          properties:
            assignments:
              type: array
              items:
                $ref: "./partitions.yaml#/components/schemas/WritableRangePartition"

    WritableFunctionPartitioning:
      allOf:
        - $ref: "#/components/schemas/FunctionPartitioning"
        - type: object
          properties:
            funcArgs:
              type: array
              items:
                $ref: "./expression.yaml#/components/schemas/WritableFunctionArg"