gravitino.dto.rel.expressions.field_reference_dto.FieldReferenceDTO

class gravitino.dto.rel.expressions.field_reference_dto.FieldReferenceDTO(field_name: List[str])

Bases: NamedReference, FunctionArg

Data transfer object representing a field reference.

__init__(field_name: List[str])

Methods

__init__(field_name)

arg_type()

Arguments type of the function.

builder()

The builder for creating a new instance of FieldReferenceDTO.

children()

Named references do not have children.

field(field_name)

Returns a FieldReference for the given field name(s).

field_from_column(column_name)

Returns a FieldReference for the given column name.

field_name()

Returns the referenced field name as a list of string parts.

references()

Named references reference themselves.

validate(columns)

Validates the function argument.

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.

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 FieldRererenceDTO

build() FieldReferenceDTO

Build the field reference.

Returns:

FieldReferenceDTO: The field reference.

with_column_name(column_name: str) Builder

Set the column name for the field reference.

Args:

column_name (str): The column name.

Returns:

FieldReferenceDTO.Builder: The builder.

with_field_name(field_name: List[str]) Builder

Set the field name for the field reference.

Args:

field_name (List[str]): The field name.

Returns:

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

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

Returns:

Builder: The builder for creating a new instance of FieldReferenceDTO.

children() list[gravitino.api.expressions.expression.Expression]

Named references do not have children.

static field(field_name: list[str]) FieldReference

Returns a FieldReference for the given field name(s). The array of field name(s) is used to reference nested fields. For example, if we have a struct column named “student” with a data type of StructType{“name”: StringType, “age”: IntegerType}, we can reference the field “name” by calling field(“student”, “name”).

@param field_name the field name(s) @return a FieldReference for the given field name(s)

static field_from_column(column_name: str) FieldReference

Returns a FieldReference for the given column name.

field_name() List[str]

Returns the referenced field name as a list of string parts. Must be implemented by subclasses.

references() list[gravitino.api.expressions.named_reference.NamedReference]

Named references reference themselves.

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.