gravitino.api.function.function_impl.FunctionImpl

class gravitino.api.function.function_impl.FunctionImpl(language: Language, runtime: RuntimeType, resources: FunctionResources | None = None, properties: Dict[str, str] | None = None)

Bases: ABC

Base class of function implementations.

A function implementation must declare its language and optional external resources. Concrete implementations are provided by SQLImpl, JavaImpl, and PythonImpl.

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

Construct a FunctionImpl.

Args:

language: The language of the function implementation. runtime: The runtime of the function implementation. resources: The resources required by the function implementation. properties: The properties of the function implementation.

Raises:

ValueError: If language or runtime is not set.

Methods

__init__(language, runtime[, resources, ...])

Construct a FunctionImpl.

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.

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.

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.