Java SDK Documentation  24.2.0
com.vertica.sdk.ParserFactory Class Referenceabstract
Inheritance diagram for com.vertica.sdk.ParserFactory:
Inheritance graph
Collaboration diagram for com.vertica.sdk.ParserFactory:
Collaboration graph

Public Member Functions

void getParameterType (ServerInterface srvInterface, SizedColumnTypes parameterTypes)
 
void getParserReturnType (ServerInterface srvInterface, PerColumnParamReader perColumnParamReader, PlanContext planCtxt, SizedColumnTypes argTypes, SizedColumnTypes returnType) throws UdfException
 
void getPerInstanceResources (ServerInterface srvInterface, VResources res)
 
void getPerInstanceResources (ServerInterface srvInterface, VResources res, SizedColumnTypes argTypes)
 
void getPrototype (ServerInterface srvInterface, ColumnTypes argTypes, ColumnTypes returnType)
 
void getReturnType (ServerInterface srvInterface, SizedColumnTypes argTypes, SizedColumnTypes returnType)
 
UDXType getUDXFactoryType ()
 
void plan (ServerInterface srvInterface, PerColumnParamReader perColumnParamReader, PlanContext planCtxt) throws UdfException
 
abstract UDParser prepare (ServerInterface srvInterface, PerColumnParamReader perColumnParamReader, PlanContext planCtxt, SizedColumnTypes returnType) throws UdfException
 

Protected Attributes

long libOid
 
String sqlName
 

Detailed Description

Produces and initializes UDParsers to parse input into tuples.

Note that ParserFactories are singletons. Subclasses should be stateless, with no fields containing data, just methods. plan() and prepare() methods must never modify any global variables or state; they may only modify the variables that they are given as arguments.

Member Function Documentation

◆ getParameterType()

void com.vertica.sdk.ParserFactory.getParameterType ( ServerInterface  srvInterface,
SizedColumnTypes  parameterTypes 
)

Inherited from the parent "UDXFactory" class in VerticaUDx.h

◆ getParserReturnType()

void com.vertica.sdk.ParserFactory.getParserReturnType ( ServerInterface  srvInterface,
PerColumnParamReader  perColumnParamReader,
PlanContext  planCtxt,
SizedColumnTypes  argTypes,
SizedColumnTypes  returnType 
) throws UdfException

Function to tell Vertica what the return types (and length/precision if necessary) of this UDX are. Called, possibly multiple times, on each node executing the query.

The default provided implementation configures Vertica to use the same output column types as the destination table. This requires that the UDParser validate the expected output column types and emit appropriate tuples.

Note that the default provided implementation of this function should be sufficient for most Parsers, so this method should not be overridden by most Parser implementations.

If a COPY statement has a return type that doesn't match the destination table, Vertica will emit an appropriate error. Users can use COPY expressions to perform typecasting and conversion if necessary.

For CHAR/VARCHAR types, specify the max length,

For Time/Timestamp types (with or without time zone), specify the precision, -1 means unspecified/don't care

For all other types, no length/precision specification needed

Parameters
srvInterfaceInterface to server operations and functionality, including (not-per-column) parameter lookup
perColumnParamReaderPer-column parameters passed into the query
planCtxtContext for storing and retrieving arbitrary data, for use just by this instance of this query. The same context is shared with plan().
argTypesProvides the data types of arguments that this UDT was called with. This may be used to modify the return types accordingly.
returnTypeUser code must fill in the names and data types returned by the UDT.
Exceptions
UdfExceptionUDF problem

◆ getPerInstanceResources()

void com.vertica.sdk.UDLFactory.getPerInstanceResources ( ServerInterface  srvInterface,
VResources  res,
SizedColumnTypes  argTypes 
)
inherited

Set the resource required for each instance of the UDX Object subclass

Parameters
srvInterfacea ServerInterface object used to communicate with Vertica
resa VResources object used to tell Vertica what resources are needed by the UDX
argTypesProvides the data types of arguments that this UDx was called with. This may be used to calculate the resources required by the UDx.

◆ getPrototype()

void com.vertica.sdk.UDLFactory.getPrototype ( ServerInterface  srvInterface,
ColumnTypes  argTypes,
ColumnTypes  returnType 
)
inherited

Provides the argument and return types of the UDL. UDL's take no input tuples; as such, their prototype is empty.

◆ getReturnType()

void com.vertica.sdk.UDLFactory.getReturnType ( ServerInterface  srvInterface,
SizedColumnTypes  argTypes,
SizedColumnTypes  returnType 
)
inherited

Not used in this form

◆ plan()

void com.vertica.sdk.ParserFactory.plan ( ServerInterface  srvInterface,
PerColumnParamReader  perColumnParamReader,
PlanContext  planCtxt 
) throws UdfException

Execute any planning logic required at query plan time. This method is run once per query, during query initialization. Its job is to perform parameter validation, and to modify the set of nodes that the COPY statement will run on (through srvInterface).

plan() runs exactly once per query, on the initiator node. If it throws an exception, the query will not proceed; it will be aborted prior to distributing the query to the other nodes and running prepare().

Parameters
srvInterfaceInterface to server operations and functionality, including (not-per-column) parameter lookup
perColumnParamReaderPer-column parameters passed into the query
planCtxtContext for storing and retrieving arbitrary data, for use just by this instance of this query. The same context is shared with plan().
Exceptions
UdfExceptionUDF problem

◆ prepare()

abstract UDParser com.vertica.sdk.ParserFactory.prepare ( ServerInterface  srvInterface,
PerColumnParamReader  perColumnParamReader,
PlanContext  planCtxt,
SizedColumnTypes  returnType 
) throws UdfException
abstract

Instantiate a UDParser instance. This function will be called on each node, prior to the Load operator starting to execute.

Parameters
srvInterfaceInterface to server operations and functionality, including (not-per-column) parameter lookup
perColumnParamReaderPer-column parameters passed into the query
planCtxtContext for storing and retrieving arbitrary data, for use just by this instance of this query. The same context is shared with plan().
returnTypeThe data types of the columns that this Parser must produce
Returns
The UDParser instance to be used by this query
Exceptions
UdfExceptionUDF problem