com.vertica.sdk.ScalarFunction Class Reference
Inheritance diagram for com.vertica.sdk.ScalarFunction:
Collaboration diagram for com.vertica.sdk.ScalarFunction:
| Classes | |
|---|---|
| enum | InterfaceType |
| Public Member Functions | |
|---|---|
| final void | cancelUDX (ServerInterface srvInterface) |
| void | destroy (ServerInterface srvInterface, SizedColumnTypes argTypes) |
| void | destroy (ServerInterface srvInterface, SizedColumnTypes argTypes, SessionParamWriterMap udSessionParams) |
| boolean | isCanceled () |
| abstract void | processBlock (ServerInterface srvInterface, BlockReader arg_reader, BlockWriter res_writer) throws UdfException, DestroyInvocation |
| void | setup (ServerInterface srvInterface, SizedColumnTypes argTypes) |
| Protected Member Functions | |
|---|---|
| void | cancel (ServerInterface srvInterface) |
| InterfaceType | getInterfaceType () |
Detailed Description
Interface for User-Defined Scalar Function (UDSF). A UDSF produces a single value from a row of data.
A UDSF can be used anywhere a native function can be used, except CREATE TABLE BY PARTITION and SEGMENTED BY expressions.
A ScalarFunction must have an associated ScalarFunctionFactory.
Member Function Documentation
◆cancel()
void com.vertica.sdk.UDXObject.cancel(ServerInterface srvInterface)
protected inherited Cancel callback to be overridden by the UDX implementation. Called when the query running the UDX has been canceled.
-
This method will be invoked at most once per UDX object. Once a UDX object has been canceled, it will never be un-canceled.
-
This method may be called from a separate thread, concurrently with other methods of this UDX object (but never the constructor). Implementations must be thread-safe with all methods of this UDX.
-
This method will be invoked for either an explicit user cancel, or in the event of an error during query execution.
Parameters
srvInterface: a ServerInterface object used to communicate with Vertica
Referenced by com.vertica.sdk.UDXObject.cancelUDX().
◆cancelUDX()
final void com.vertica.sdk.UDXObject.cancelUDX(ServerInterface srvInterface)
inherited Cancel callback invoked when the query running the UDX has been canceled.
See cancel().
Parameters
srvInterface: a ServerInterface object used to communicate with Vertica
◆destroy() [1/2]
void com.vertica.sdk.UDXFunction.destroy(ServerInterface srvInterface, SizedColumnTypes argTypes)
inherited Perform per instance destruction. This function may throw errors
Parameters
srvInterface: a ServerInterface object used to communicate with VerticaargTypes: the types of the arguments (as SizedColumnTypes)
Referenced by com.vertica.sdk.UDXFunction.destroy().
◆destroy() [2/2]
void com.vertica.sdk.UDXFunction.destroy(ServerInterface srvInterface, SizedColumnTypes argTypes, SessionParamWriterMap udSessionParams)
inherited Perform per instance destruction and write session parameters to be used by UDxs that are invoked after this one returns. This function may throw errors
Parameters
srvInterface: a ServerInterface object used to communicate with VerticaargTypes: the types of the arguments (as SizedColumnTypes)udSessionParams: a SessionParamWriterMap
◆isCanceled()
boolean com.vertica.sdk.UDXObject.isCanceled()
inherited Returns true if execution was canceled.
Referenced by com.vertica.sdk.UDXObject.cancelUDX().
◆processBlock()
abstract void com.vertica.sdk.ScalarFunction.processBlock(ServerInterface srvInterface, BlockReader arg_reader, BlockWriter res_writer) throws UdfException, DestroyInvocation
abstract
Invoke a user defined function on a set of rows. As the name suggests, a batch of rows are passed in for every invocation to amortize performance.
Notes:
-
This methods may be invoked by different threads at different times, and by a different thread than the constructor.
-
The order in which the function sees rows is not guaranteed.
-
To report error to Vertica, throw a UdfException object
Parameters
srvInterface: a ServerInterface object used to communicate with Verticaarg_reader: input rowsres_writer: output location
Exceptions
UdfException: UDF problemDestroyInvocation: vertica canceling – do not catch or handle
◆setup()
void com.vertica.sdk.UDXFunction.setup(ServerInterface srvInterface, SizedColumnTypes argTypes)
inherited Perform per instance initialization. This function may throw errors.
Parameters
srvInterface: a ServerInterface object used to communicate with VerticaargTypes: the types of the arguments (as SizedColumnTypes)