Factory function
The factory function consists of an R list which specifies the parameters of your R user-defined extension (UDx).
Example
FunctionNameFactory <- function() {
list(name = MainFunctionName,
udxtype = c("scalar"),
intype = c("float","int", ...),
outtype = c("float", ...),
outtypecallback = MyReturnTypeFunc,
parametertypecallback = MyParamReturnFunc,
volatility = c("volatile"),
strictness = c("called_on_null_input") )
}
Arguments
name |
The name of the R function in this UDx that is called when the function is invoked by Vertica, and which returns the value(s) back to Vertica. |
udxtype |
The type of UDx, one of the following:
|
intype |
Data types of arguments accepted by the function. UDxs support up to 9800 arguments. |
outtype |
Data types of the arguments returned by the function. |
outtypecallback |
(Optional) The callback function to call before sending the data back to Vertica, which defines the types and precision that the main function returns. |
parametertypecallback |
The callback function to send parameter types and names to Vertica. This parameter is required if your UDx is called from Vertica with USING PARAMETERS. |
volatility |
(Optional) Indicates whether the function returns the same output given the same input, one of the following:
For details, see Setting null input and volatility behavior for R functions. |
strictness |
(Optional) Indicates whether the function always returns NULL when any input argument is NULL, one of the following:
For details, see Setting null input and volatility behavior for R functions. |
Description
User-defined functions in R (R UDx) require a factory function for each main R function that you want to call from within Vertica. The factory function encapsulates all the information required by Vertica to load the R UDx.