gravitino.api.function.python_impl.PythonImpl¶
- class gravitino.api.function.python_impl.PythonImpl(runtime: RuntimeType, handler: str, code_block: str | None = None, resources: FunctionResources | None = None, properties: Dict[str, str] | None = None)¶
Bases:
FunctionImplPython implementation with handler and optional inline code.
- __init__(runtime: RuntimeType, handler: str, code_block: str | None = None, resources: FunctionResources | None = None, properties: Dict[str, str] | None = None)¶
Create a PythonImpl instance.
- Args:
runtime: The runtime of the function implementation. handler: The handler entrypoint. code_block: The Python UDF code block. resources: The resources required by the function implementation. properties: The properties of the function implementation.
- Raises:
ValueError: If handler is null or empty.
Methods
__init__(runtime, handler[, code_block, ...])Create a PythonImpl instance.
builder()Returns a new Builder for PythonImpl.
Returns the Python UDF code block.
handler()Returns the handler entrypoint.
language()Returns the implementation language.
Returns the additional properties of this implementation.
Returns the external resources required by this implementation.
runtime()Returns the target runtime.
- class Builder¶
Bases:
objectBuilder for PythonImpl.
- build() PythonImpl¶
Builds a PythonImpl instance.
- Returns:
A new PythonImpl instance.
- Raises:
IllegalArgumentException: If required fields are not set.
- with_code_block(code_block: str) Builder¶
Sets the code block.
- Args:
code_block: The Python UDF code block.
- Returns:
The builder instance.
- with_handler(handler: str) Builder¶
Sets the handler.
- Args:
handler: The handler entrypoint.
- Returns:
The builder instance.
- 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.
- class Language(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
EnumSupported 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:
EnumSupported 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.
- code_block() str | None¶
Returns the Python UDF code block.
- handler() str¶
Returns the handler entrypoint.
- 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.