gravitino.api.column.Column

class gravitino.api.column.Column

Bases: ABC

An interface representing a column of a Table.

It defines basic properties of a column, such as name and data type.

Catalog implementation needs to implement it. They should consume it in APIs like TableCatalog.createTable(NameIdentifier, List[Column], str, Dict), and report it in Table.columns() a default value and a generation expression.

__init__()

Methods

__init__()

auto_increment()

Indicate if this column is an auto-increment column.

comment()

Get the comment of this column.

data_type()

Get the name of this column.

default_value()

Get the default value of this column

name()

Get the name of this column.

nullable()

Indicate if this column may produce null values.

of(name, data_type[, comment, nullable, ...])

Create a Column instance.

supports_tags()

Return the SupportsTags if the column supports tag operations.

Attributes

DEFAULT_VALUE_NOT_SET

A default value that indicates the default value is not set.

DEFAULT_VALUE_OF_CURRENT_TIMESTAMP

A default value that indicates the default value will be set to the current timestamp.

DEFAULT_VALUE_NOT_SET = []

A default value that indicates the default value is not set. This is used in default_value()

DEFAULT_VALUE_OF_CURRENT_TIMESTAMP: Expression = <gravitino.api.expressions.function_expression.FuncExpressionImpl object>

A default value that indicates the default value will be set to the current timestamp. This is used in default_value()

abstract auto_increment() bool

Indicate if this column is an auto-increment column.

Returns:

bool: True if this column is an auto-increment column. Default is False.

abstract comment() str | None

Get the comment of this column.

Returns:

Optional[str]: The comment of this column, None if not specified.

abstract data_type() Type

Get the name of this column.

Returns:

Type: The data type of this column.

abstract default_value() Expression

Get the default value of this column

Returns:
Expression:

The default value of this column, Column.DEFAULT_VALUE_NOT_SET if not specified.

abstract name() str

Get the name of this column.

Returns:

str: The name of this column.

abstract nullable() bool

Indicate if this column may produce null values.

Returns:

bool: True if this column may produce null values. Default is True.

static of(name: str, data_type: Type, comment: str | None = None, nullable: bool = True, auto_increment: bool = False, default_value: Expression | None = None) ColumnImpl

Create a Column instance.

Args:
name (str):

The name of the column.

data_type (Type):

The data type of the column.

comment (Optional[str], optional):

The comment of the column. Defaults to None.

nullable (bool, optional):

True if the column may produce null values. Defaults to True.

auto_increment (bool, optional):

True if the column is an auto-increment column. Defaults to False.

default_value (Optional[Expression], optional):

The default value of this column, Column.DEFAULT_VALUE_NOT_SET if None. Defaults to None.

Returns:

ColumnImpl: A Column instance.

supports_tags() SupportsTags

Return the SupportsTags if the column supports tag operations.

Raises:

UnsupportedOperationException: if the column does not support tag operations.

Returns:

SupportsTags: the SupportsTags if the column supports tag operations.