gravitino.api.function.sql_impl.SQLImpl

class gravitino.api.function.sql_impl.SQLImpl(runtime: RuntimeType, sql: str, resources: FunctionResources | None = None, properties: Dict[str, str] | None = None)

Bases: FunctionImpl

SQL implementation with runtime and SQL body.

__init__(runtime: RuntimeType, sql: str, resources: FunctionResources | None = None, properties: Dict[str, str] | None = None)

Create a SQLImpl instance.

Args:

runtime: The runtime of the function implementation. sql: The SQL that defines the function. resources: The resources required by the function implementation. properties: The properties of the function implementation.

Raises:

ValueError: If sql is null or empty.

Methods

__init__(runtime, sql[, resources, properties])

Create a SQLImpl instance.

builder()

Returns a new Builder for SQLImpl.

language()

Returns the implementation language.

properties()

Returns the additional properties of this implementation.

resources()

Returns the external resources required by this implementation.

runtime()

Returns the target runtime.

sql()

Returns the SQL that defines the function.

class Builder

Bases: object

Builder for SQLImpl.

build() SQLImpl

Builds a SQLImpl instance.

Returns:

A new SQLImpl instance.

Raises:

IllegalArgumentException: If required fields are not set.

with_properties(properties: Dict[str, str]) Builder

Sets the properties.

Args:

properties: The properties of the function implementation.

Returns:

The builder instance.

with_resources(resources: FunctionResources) Builder

Sets the resources.

Args:

resources: The resources required by the function implementation.

Returns:

The builder instance.

with_runtime_type(runtime: RuntimeType) Builder

Sets the runtime type.

Args:

runtime: The runtime of the function implementation.

Returns:

The builder instance.

with_sql(sql: str) Builder

Sets the SQL text.

Args:

sql: The SQL that defines the function.

Returns:

The builder instance.

class Language(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Supported implementation languages.

JAVA = 'JAVA'

Java implementation.

PYTHON = 'PYTHON'

Python implementation.

SQL = 'SQL'

SQL implementation.

class RuntimeType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Supported execution runtimes for function implementations.

SPARK = 'SPARK'

Spark runtime.

TRINO = 'TRINO'

Trino runtime.

classmethod from_string(value: str) RuntimeType

Parse a runtime value from string.

Args:

value: Runtime name.

Returns:

Parsed runtime.

Raises:

ValueError: If the runtime is not supported.

static builder() Builder

Returns a new Builder for SQLImpl.

language() Language

Returns the implementation language.

properties() Dict[str, str]

Returns the additional properties of this implementation.

resources() FunctionResources

Returns the external resources required by this implementation.

runtime() RuntimeType

Returns the target runtime.

sql() str

Returns the SQL that defines the function.