Create table
POST/metalakes/:metalake/catalogs/:catalog/schemas/:schema/tables
Create table
Request
Path Parameters
The name of the metalake
The name of the catalog
The name of the schema
- application/json
Body
Array [
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
Array [
]
]
Array [
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
Array [
]
]
Array [
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
Array [
]
]
Array [
- IdentityPartitioning
- YearPartitioning
- MonthPartitioning
- DayPartitioning
- HourPartitioning
- BucketPartitioning
- TruncatePartitioning
- ListPartitioning
- RangePartitioning
- FunctionPartitioning
Array [
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
Array [
]
]
]
The name of the table
columns
object[]
required
A list of columns
The name of the column
type
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
The comment of the column
Default value: true
Whether the column is nullable
The comment of the table
properties
object
nullable
A map of table properties
sortOrders
object[]
nullable
Describes the sort order of the table data
sortTerm
object
required
oneOf
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
The string format of the literal value
Possible values: [field
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the function
The arguments of the function
Possible values: [asc
, desc
]
Default value: asc
The direction of the sort order
Possible values: [nulls_first
, nulls_last
]
| The sort order of null values. The default value is "nulls_first" if the direction is "asc", otherwise "nulls_last".
distribution
object
nullable
Describes how data is distributed across partitions
Possible values: [hash
, range
, even
]
Default value: hash
The distribution strategy
The number of buckets/distribution
funcArgs
object[]
nullable
required
The arguments of the distribution function
oneOf
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
The string format of the literal value
Possible values: [field
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the function
The arguments of the function
partitioning
object[]
nullable
partitioning of the table data
oneOf
Possible values: [identity
]
The name of the field, may be with multiple levels
Possible values: [year
]
The name of the field, may be with multiple levels
Possible values: [month
]
The name of the field, may be with multiple levels
Possible values: [day
]
The name of the field, may be with multiple levels
Possible values: [hour
]
The name of the field, may be with multiple levels
Possible values: [bucket
]
The number of buckets
The names of the fields, each field may be with multiple levels
Possible values: [truncate
]
The width of the truncate
The name of the field, may be with multiple levels
Possible values: [list
]
The names of the fields, each field may be with multiple levels
Possible values: [range
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the partitioning function
funcArgs
object[]
required
The arguments of the partitioning function
oneOf
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
The string format of the literal value
Possible values: [field
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the function
The arguments of the function
Responses
- 200
- 409
- 5xx
Returns include the table object
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- TableResponse
Schema
Array [
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
Array [
]
]
Array [
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
Array [
]
]
Array [
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
Array [
]
]
Array [
- IdentityPartitioning
- YearPartitioning
- MonthPartitioning
- DayPartitioning
- HourPartitioning
- BucketPartitioning
- TruncatePartitioning
- ListPartitioning
- RangePartitioning
- FunctionPartitioning
Array [
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
Array [
]
]
]
Possible values: [0
]
Status code of the response
table
object
A table object
The name of the table
columns
object[]
required
A list of columns
The name of the column
type
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
The comment of the column
Default value: true
Whether the column is nullable
The comment of the table
audit
object
required
Audit information for a Gravitino resource.
The user who created the resource
The time the resource was created
The user who last modified the resource
The time the resource was last modified
properties
object
nullable
A map of table properties
distribution
object
nullable
Describes how data is distributed across partitions
Possible values: [hash
, range
, even
]
Default value: hash
The distribution strategy
The number of buckets/distribution
funcArgs
object[]
nullable
required
The arguments of the distribution function
oneOf
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
The string format of the literal value
Possible values: [field
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the function
The arguments of the function
sortOrders
object[]
nullable
Describes the sort order of the table data
sortTerm
object
required
oneOf
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
The string format of the literal value
Possible values: [field
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the function
The arguments of the function
Possible values: [asc
, desc
]
Default value: asc
The direction of the sort order
Possible values: [nulls_first
, nulls_last
]
| The sort order of null values. The default value is "nulls_first" if the direction is "asc", otherwise "nulls_last".
partitioning
object[]
nullable
partitioning of the table data
oneOf
Possible values: [identity
]
The name of the field, may be with multiple levels
Possible values: [year
]
The name of the field, may be with multiple levels
Possible values: [month
]
The name of the field, may be with multiple levels
Possible values: [day
]
The name of the field, may be with multiple levels
Possible values: [hour
]
The name of the field, may be with multiple levels
Possible values: [bucket
]
The number of buckets
The names of the fields, each field may be with multiple levels
Possible values: [truncate
]
The width of the truncate
The name of the field, may be with multiple levels
Possible values: [list
]
The names of the fields, each field may be with multiple levels
Possible values: [range
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the partitioning function
funcArgs
object[]
required
The arguments of the partitioning function
oneOf
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
The string format of the literal value
Possible values: [field
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the function
The arguments of the function
{
"code": 0,
"table": {
"name": "string",
"columns": [
{
"name": "string",
"type": [
"boolean",
"byte",
"short",
"integer",
"long",
"float",
"double",
"decimal(10,2)",
"date",
"time",
"timestamp",
"timestamp_tz",
"string",
"char(10)",
"varchar(10)",
"interval_day",
"interval_year",
"uuid",
"fixed(16)",
"binary"
],
"comment": "string",
"nullable": true
}
],
"comment": "string",
"audit": {
"creator": "string",
"createTime": "2023-12-13T12:11:10.320Z",
"lastModifier": "string",
"lastModifiedTime": "2023-12-13T12:11:10.320Z"
},
"properties": {},
"distribution": {
"strategy": "hash",
"number": 0,
"funcArgs": [
{},
{},
{}
]
},
"sortOrders": [
{
"sortTerm": {},
"direction": "asc",
"nullOrdering": "nulls_first"
}
],
"partitioning": [
{},
{},
{},
{},
{},
{},
{},
{},
{},
{}
]
}
}
{
"code": 0,
"table": {
"name": "my_hive_table",
"comment": "This is my Hive table",
"columns": [
{
"name": "id",
"type": "integer",
"comment": "id column comment",
"nullable": 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": {
"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"
]
}
]
}
}
Conflict - The target table already exists
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- TableAlreadyExistsErrorResponse
Schema
Possible values: >= 1000
and <= 1100
HTTP response code
Internal type definition of the error
A human-readable message
{
"code": 1002,
"type": "string",
"message": "string",
"stack": [
"string"
]
}
{
"code": 1004,
"type": "TableAlreadyExistsException",
"message": "Failed to operate table(s) [my_hive_table] operation [CREATE] under schema [my_hive_schema], reason [TableAlreadyExistsException]",
"stack": [
"com.datastrato.gravitino.exceptions.TableAlreadyExistsException: Table already exists: my_hive_table",
"..."
]
}
A server-side problem that might not be addressable from the client side. Used for server 5xx errors without more specific documentation in individual routes.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- Example
Schema
Possible values: >= 1000
and <= 1100
HTTP response code
Internal type definition of the error
A human-readable message
{
"code": 1002,
"type": "string",
"message": "string",
"stack": [
"string"
]
}
{
"code": 1002,
"type": "RuntimeException",
"message": "Internal Server Error",
"stack": [
"java.lang.RuntimeException: Internal Server Error"
]
}