C++ SDK Documentation  12.0.0
Vertica::SourceFactory Class Reference

Produces and initializes UDSources to process input data sources. More...

Inheritance diagram for Vertica::SourceFactory:
Inheritance graph
Collaboration diagram for Vertica::SourceFactory:
Collaboration graph

Public Types

enum  UDXType {
  SCALAR = 1, TRANSFORM = 2, ANALYTIC = 3, MULTI_TRANSFORM = 4,
  AGGREGATE = 5, LOAD_SOURCE = 6, LOAD_FILTER = 7, LOAD_PARSER = 8,
  FILESYSTEM = 9, TYPE = 10, CURSOR_TRANSFORM = 11, KEYMANAGER = 12
}
 

Public Member Functions

virtual ssize_t getDesiredThreads (ServerInterface &srvInterface, ExecutorPlanContext &planCtxt) __override__
 
virtual void getParameterType (ServerInterface &srvInterface, SizedColumnTypes &parameterTypes)
 
virtual void getPerInstanceResources (ServerInterface &srvInterface, VResources &res) __override__
 
virtual void getPerInstanceResources (ServerInterface &srvInterface, VResources &res, const SizedColumnTypes &inputTypes) __override__
 
UDXFactory::UDXType getUDXFactoryType () __override__
 
virtual bool isSourceApportionable ()
 
virtual void plan (ServerInterface &srvInterface, NodeSpecifyingPlanContext &planCtxt) __override__
 
virtual SourceIteratorprepare (ServerInterface &srvInterface, NodeSpecifyingPlanContext &planCtxt)
 
virtual SourceIteratorprepareExecutor (ServerInterface &srvInterface, ExecutorPlanContext &planCtxt)
 
virtual std::vector< UDSource * > prepareUDSources (ServerInterface &srvInterface, NodeSpecifyingPlanContext &planCtxt)
 
virtual std::vector< UDSource * > prepareUDSourcesExecutor (ServerInterface &srvInterface, ExecutorPlanContext &planCtxt)
 

Protected Attributes

Oid libOid
 
std::string sqlName
 

Detailed Description

Produces and initializes UDSources to process input data sources.

Subclassing SourceFactory is the preferred way to implement a factory corresponding to a UDSource. If you need more flexibility, implement both IterativeSourceFactory and SourceIterator. (See the documentation of IterativeSourceFactory.)

Factories should be registered using the RegisterFactory() macro, defined in Vertica.h.

Member Enumeration Documentation

The type of UDX instance this factory produces

Member Function Documentation

virtual ssize_t Vertica::SourceFactory::getDesiredThreads ( ServerInterface srvInterface,
ExecutorPlanContext planCtxt 
)
inlinevirtual

Request the number of threads that the SourceFactory wants to use. This function is called on each node before prepareUDSources().

'planCtxt' contains the same parameters stored by plan(). It exposes the maximum number of allowed threads, via 'getMaxAllowedThreads()', and also the actual number of threads, via 'getLoadConcurrency()'.

The default implementation of this invokes prepare(), saves the result in the ExecutorPlanContext, and returns the number of sources as the number of desired threads.

Reimplemented from Vertica::IterativeSourceFactory.

virtual void Vertica::UDXFactory::getParameterType ( ServerInterface srvInterface,
SizedColumnTypes parameterTypes 
)
inlinevirtualinherited

Function to tell Vertica the name and types of parameters that this function uses. Vertica will use this to warn function callers that certain parameters they provide are not affecting anything, or that certain parameters that are not being set are reverting to default values.

Reimplemented in Vertica::ParserFactory.

virtual void Vertica::UDLFactory::getPerInstanceResources ( ServerInterface srvInterface,
VResources res 
)
inlinevirtualinherited

Set the resource required for each instance of the UDX Object subclass. Users should override only one of the following methods.

Parameters
srvInterfacea ServerInterface object used to communicate with Vertica
resa VResources object used to tell Vertica what resources are needed by the UDX

Reimplemented from Vertica::UDXFactory.

Referenced by Vertica::UDLFactory::getPerInstanceResources().

virtual void Vertica::UDLFactory::getPerInstanceResources ( ServerInterface srvInterface,
VResources res,
const SizedColumnTypes inputTypes 
)
inlinevirtualinherited

Set the resource required for each instance of the UDX Object subclass. Users should override only one of the following methods.

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 UDT was called with

Reimplemented from Vertica::UDXFactory.

UDXFactory::UDXType Vertica::IterativeSourceFactory::getUDXFactoryType ( )
inlinevirtualinherited
Returns
the type of UDX Object instance this factory returns.
Note
User subclasses should use the appropriate subclass of UDXFactory and not override this method on their own.

Implements Vertica::UDXFactory.

virtual void Vertica::SourceFactory::plan ( ServerInterface srvInterface,
NodeSpecifyingPlanContext planCtxt 
)
inlinevirtual

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.

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
planCtxtContext for storing and retrieving arbitrary data, for use just by this instance of this query. The same context is shared with plan(). Also provides functionality for specifying which nodes this query will run on.

Reimplemented from Vertica::IterativeSourceFactory.

virtual SourceIterator* Vertica::IterativeSourceFactory::prepareExecutor ( ServerInterface srvInterface,
ExecutorPlanContext planCtxt 
)
inlinevirtualinherited

Prepare this SourceFactory to start creating sources. This function will be called on each node, prior to the Load operator starting to execute and prior to any other virtual functions on this class being called.

'planCtxt' contains the same data that was placed there by the plan() and getDesiredThreads() methods.

Referenced by getDesiredThreads().

virtual std::vector<UDSource*> Vertica::SourceFactory::prepareUDSourcesExecutor ( ServerInterface srvInterface,
ExecutorPlanContext planCtxt 
)
inlinevirtual

Create UDSources. This function will be called on each node, prior to the Load operator starting to execute and prior to any other virtual functions on this class being called.

'planCtxt' contains the same data that was placed there by the plan() and getDesiredThreads() methods. It also exposes the maximum execution parallelism with 'getMaxAllowedThreads()' and the actual load concurrency with 'getLoadConcurrency()'.

Unlike the standard SourceFactory, this method directly instantiates all of its UDSources, and returns a vector of them. This requires that all UDSources be resident in memory for the duration of the query, which is fine in the common case but which may not be acceptable for some resource-intensive UDSources.

Parameters
srvInterfaceInterface to server operations and functionality, including (not-per-column) parameter lookup
planCtxtContext for storing and retrieving arbitrary data, for use just by this instance of this query. The same context is shared with plan() and getDesiredThreads(). Also provides functionality for determining which nodes this query is running on and getting the number of available threads.
Returns
A vector of UDSources to use for this query. Sources will be loaded in a pooled manner, several at a time.