C++ SDK Documentation  9.0
Vertica::IterativeSourceFactory Class Reference

Source factory that works with a SourceIterator to produce UDSources. More...

Inheritance diagram for Vertica::IterativeSourceFactory:
Inheritance graph
Collaboration diagram for Vertica::IterativeSourceFactory:
Collaboration graph

Public Types

enum  UDXType {
  FUNCTION, TRANSFORM, ANALYTIC, MULTI_TRANSFORM,
  AGGREGATE, LOAD_SOURCE, LOAD_FILTER, LOAD_PARSER,
  FILESYSTEM, TYPE, CURSOR_TRANSFORM
}
 

Public Member Functions

virtual ssize_t getDesiredThreads (ServerInterface &srvInterface, ExecutorPlanContext &planCtxt)
 
virtual void getParameterType (ServerInterface &srvInterface, SizedColumnTypes &parameterTypes)
 
virtual void getPerInstanceResources (ServerInterface &srvInterface, VResources &res)
 
virtual void getPerInstanceResources (ServerInterface &srvInterface, VResources &res, const SizedColumnTypes &inputTypes)
 
void getPrototype (ServerInterface &srvInterface, ColumnTypes &argTypes, ColumnTypes &returnType)
 
virtual void getReturnType (ServerInterface &srvInterface, const SizedColumnTypes &argTypes, SizedColumnTypes &returnType)
 
UDXFactory::UDXType getUDXFactoryType ()
 
virtual bool isSourceApportionable ()
 
virtual void plan (ServerInterface &srvInterface, NodeSpecifyingPlanContext &planCtxt)
 
virtual SourceIteratorprepare (ServerInterface &srvInterface, NodeSpecifyingPlanContext &planCtxt)
 
virtual SourceIteratorprepareExecutor (ServerInterface &srvInterface, ExecutorPlanContext &planCtxt)
 

Protected Attributes

Oid libOid
 
std::string sqlName
 

Detailed Description

Source factory that works with a SourceIterator to produce UDSources.

Usually it is easier to subclass SourceFactory and have its prepareUDSources() method return a vector of UDSource objects. Behind the scenes, Vertica uses a built-in iterator to pull sources from that vector. However, if you need to be able to control source management at this level, you can instead write your own SourceIterator and use it with an IterativeSourceFactory.

This class performs initial validation and planning of a query, before it is distributed over the network. It also instantiates objects to perform further initialization on each node, once the query has been distributed.

Note that SourceFactories 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. (If global state must be modified, use SourceIterator.)

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::IterativeSourceFactory::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 prepare().

'planCtxt' contains the same parameters stored by plan() method. It also exposes the maximum number of allowed threads, via 'getMaxAllowedThreads()'. Further computations can be stored in its 'ExecutorParamWriter' object, for use in prepare().

Reimplemented in Vertica::SourceFactory.

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.

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.

void Vertica::UDLFactory::getPrototype ( ServerInterface srvInterface,
ColumnTypes argTypes,
ColumnTypes returnType 
)
inlinevirtualinherited

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

Implements Vertica::UDXFactory.

virtual void Vertica::UDLFactory::getReturnType ( ServerInterface srvInterface,
const SizedColumnTypes argTypes,
SizedColumnTypes returnType 
)
inlinevirtualinherited

Not used in this form

Implements Vertica::UDXFactory.

UDXFactory::UDXType Vertica::IterativeSourceFactory::getUDXFactoryType ( )
inlinevirtual
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::IterativeSourceFactory::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().

Reimplemented in Vertica::SourceFactory.

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

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.