gravitino.dto.rel.expressions.literal_dto.LiteralDTO

class gravitino.dto.rel.expressions.literal_dto.LiteralDTO(value: str, data_type: Type)

Bases: Literal[str], FunctionArg

Represents a Literal Data Transfer Object (DTO) that implements the Literal interface.

__init__(value: str, data_type: Type)

Methods

__init__(value, data_type)

arg_type()

Arguments type of the function.

builder()

the builder for creating a new instance of LiteralDTO.

children()

Returns a list of the children of this node.

data_type()

The data type of the literal.

references()

Returns a list of fields or columns that are referenced by this expression.

validate(columns)

Validates the function argument.

value()

The literal value.

Attributes

EMPTY_ARGS

EMPTY_EXPRESSION

EMPTY_EXPRESSION is only used as an input when the default children method builds the result.

EMPTY_NAMED_REFERENCE

EMPTY_NAMED_REFERENCE is only used as an input when the default references method builds the result array to avoid repeatedly allocating an empty array.

NULL

An instance of LiteralDTO with a value of "NULL" and a data type of Types.NullType.get().

class ArgType(value)

Bases: str, Enum

The type of the argument.

The supported types are:

  • LITERAL: A literal argument.

  • FIELD: A field argument.

  • FUNCTION: A function argument.

  • UNPARSED: An unparsed argument.

class Builder

Bases: object

Builder for LiteralDTO.

build() LiteralDTO

Builds a LiteralDTO instance.

Returns:

LiteralDTO: The LiteralDTO instance.

with_data_type(data_type: Type) LiteralDTO.Builder

Set the data type of the literal.

Args:

data_type (Type): The data type of the literal.

Returns:

Builder: The builder.

with_value(value: str) Builder

Set the value of the literal.

Args:

value (str): The value of the literal.

Returns:

Builder: The builder.

EMPTY_EXPRESSION: List[Expression] = []

EMPTY_EXPRESSION is only used as an input when the default children method builds the result.

EMPTY_NAMED_REFERENCE: List[NamedReference] = []

EMPTY_NAMED_REFERENCE is only used as an input when the default references method builds the result array to avoid repeatedly allocating an empty array.

NULL: ClassVar[LiteralDTO] = <gravitino.dto.rel.expressions.literal_dto.LiteralDTO object>

An instance of LiteralDTO with a value of “NULL” and a data type of Types.NullType.get().

arg_type() ArgType

Arguments type of the function.

Returns:

ArgType: The type of this argument.

static builder() Builder

the builder for creating a new instance of LiteralDTO.

Returns:

Builder: the builder for creating a new instance of LiteralDTO.

children() List[Expression]

Returns a list of the children of this node. Children should not change.

data_type() Type

The data type of the literal.

Returns:

Type: The data type of the literal.

references() List[NamedReference]

Returns a list of fields or columns that are referenced by this expression.

validate(columns: List[ColumnDTO]) None

Validates the function argument.

Args:

columns (List[ColumnDTO]): The columns of the table.

Raises:

IllegalArgumentException: If the function argument is invalid.

value() str

The literal value.

Returns:

str: The value of the literal.