C++ SDK Documentation  24.1.0
Vertica::PartitionWriter Class Reference

Provides an iterator-based write interface over output data for a single partition. Automatically makes space a block-at-a-time, as needed. More...

Inheritance diagram for Vertica::PartitionWriter:
Inheritance graph
Collaboration diagram for Vertica::PartitionWriter:
Collaboration graph

Public Member Functions

 PartitionWriter (size_t narg)
 
 PartitionWriter (size_t narg, EE::UserDefinedProcess *udx_object)
 
 PartitionWriter (size_t narg, size_t nrows, EE::UserDefinedProcess *udx_object)
 
void copy (const VerticaBlock &other)
 
void copyFromInput (size_t dstIdx, const BlockReader &input_reader, size_t srcIdx)
 
void copyFromInput (const BlockReader &input_reader)
 
Array::ArrayWriter getArrayRef (size_t idx)
 
template<class T >
const T * getColPtr (size_t idx) const
 
template<>
const VStringgetColPtr (size_t idx) const
 
template<>
const VNumericgetColPtr (size_t idx) const
 
template<>
const VUuidgetColPtr (size_t idx) const
 
template<>
const BlockReadergetColPtr (size_t idx) const
 
template<class T >
T * getColPtrForWrite (size_t idx)
 
template<>
VStringgetColPtrForWrite (size_t idx)
 
template<>
VNumericgetColPtrForWrite (size_t idx)
 
template<>
VUuidgetColPtrForWrite (size_t idx)
 
template<>
BlockWritergetColPtrForWrite (size_t idx)
 
template<class T >
const T & getColRef (size_t idx) const
 
template<class T >
T & getColRefForWrite (size_t idx)
 
int getColStride (size_t idx) const
 
PartitionWriterColumns getColumns ()
 
const EE::DataAreagetDataArea (size_t idx) const
 
size_t getNumCols () const
 
VNumericgetNumericRef (size_t idx)
 
int getNumRows () const
 
BlockWritergetRowPtr (size_t idx)
 
BlockWritergetRowRef (size_t idx)
 Get a reference for writing an output Row value. More...
 
VStringgetStringRef (size_t idx)
 
VStringgetStringRefNoClear (size_t idx)
 
const SizedColumnTypesgetTypeMetaData () const
 
SizedColumnTypesgetTypeMetaData ()
 
VUuidgetUuidRef (size_t idx)
 
const void * getVoidPtr (size_t idx=0) const
 
void * getVoidPtr (size_t idx)
 
virtual bool getWriteableBlock ()
 
bool next ()
 
bool remaining () const
 
virtual void resetForDataAreaFlush ()
 
void setBool (size_t idx, vbool r)
 
void setDataArea (size_t idx, void *dataarea)
 
void setDate (size_t idx, DateADT r)
 
void setFloat (size_t idx, vfloat r)
 
void setInt (size_t idx, vint r)
 
void setInterval (size_t idx, Interval r)
 
void setIntervalYM (size_t idx, IntervalYM r)
 
void setNull (size_t idx)
 Set the idx'th argument to null. If a column has the canBeNull attribute set to false, then this throws an exception. More...
 
void setNull (size_t idx, bool enforceNotNullProperty)
 Set the idx'th argument to null. More...
 
void setTime (size_t idx, TimeADT r)
 
void setTimestamp (size_t idx, Timestamp r)
 
void setTimestampTz (size_t idx, TimestampTz r)
 
void setTimeTz (size_t idx, TimeTzADT r)
 
void throwIncorrectUsageError (size_t idx)
 

Protected Member Functions

void addCol (char *arg, int colstride, const Field &field)
 
void addCol (const char *arg, int colstride, const Field &field)
 
bool checkStringUserBlockInfo (size_t idx) const
 
bool checkTimeUserBlockInfo (size_t idx) const
 
bool commitPrefilledRows (int nRows)
 
EE::DataArea ** getArrayIntermediateDataArea (size_t c)
 
void reset ()
 
void resetIndex ()
 
void setRowCount (int rowCount)
 
void validateStringColumn (size_t idx, const VString &s, size_t colLength) const
 

Protected Attributes

union {
   EE::UserDefinedAnalytic *   udan
 
   EE::UserDefinedTransform *   udt
 
   EE::UserDefinedProcess *   udx_object
 
}; 
 
std::vector< char * > cols
 
std::vector< int > colstrides
 
int count
 
std::vector< NestedBlockPtrctWrappers
 
int index
 
const int * indices
 
size_t ncols
 
int nrows
 
std::vector< BaseDataOID > processBlockUserInfoVector
 
int pstart
 
std::vector< VStringsvWrappers
 
SizedColumnTypes typeMetaData
 
std::vector< VUuiduuWrappers
 
std::vector< VNumericvnWrappers
 

Friends

class EE::Loader::UserDefinedLoad
 
class EE::UserDefinedAnalytic
 
class EE::UserDefinedProcess
 
class EE::UserDefinedTransform
 
class PartitionWriterColumns
 

Detailed Description

Provides an iterator-based write interface over output data for a single partition. Automatically makes space a block-at-a-time, as needed.

Member Function Documentation

◆ addCol()

void Vertica::VerticaBlock::addCol ( char *  arg,
int  colstride,
const Field field 
)
protectedinherited

Add the location for reading a particular argument.

Parameters
argThe base location to find data.
colstrideThe stride between data instances.
fieldmetadata for the added column
dtThe type of input.
fieldnamethe name of the field

Referenced by Vertica::ParamReader::addParameter().

◆ copyFromInput()

void Vertica::PartitionWriter::copyFromInput ( size_t  dstIdx,
const BlockReader input_reader,
size_t  srcIdx 
)

Copies a column from the input reader to the output writer. Raises an error if the input and output data types are not compatible.

Parameters
dstIdxThe destination column index (in the output writer)
input_readerThe input reader from which to copy a column
srcIdxThe source column index (in the input reader)

◆ getArrayIntermediateDataArea()

EE::DataArea** Vertica::VerticaBlock::getArrayIntermediateDataArea ( size_t  c)
inlineprotectedinherited
Returns
a pointer to a DataArea for accumulating an intermediate result

◆ getColPtr()

template<class T >
const T* Vertica::VerticaBlock::getColPtr ( size_t  idx) const
inlineinherited
Returns
a pointer to the idx'th argument, cast appropriately.

Example:

const vint *a = arg_reader->getColPtr<vint>(0);

◆ getColRef()

template<class T >
const T& Vertica::VerticaBlock::getColRef ( size_t  idx) const
inlineinherited
Returns
a pointer to the idx'th argument, cast appropriately.

Example: const vint a = arg_reader->getColRef<vint>(0);

◆ getNumCols()

size_t Vertica::VerticaBlock::getNumCols ( ) const
inlineinherited
Returns
the number of columns held by this block.

Referenced by Vertica::BlockWriter::copyFromInput(), Vertica::BlockReader::isNull(), and Vertica::BlockWriter::setNull().

◆ getNumRows()

int Vertica::VerticaBlock::getNumRows ( ) const
inlineinherited
Returns
the number of rows held by this block.

◆ getRowRef()

BlockWriter& Vertica::PartitionWriter::getRowRef ( size_t  idx)
inline

Get a reference for writing an output Row value.

Parameters
idxthe output column
Returns
a reference to a BlockWriter which holds output data for the Row value's fields

◆ getTypeMetaData() [1/2]

const SizedColumnTypes& Vertica::VerticaBlock::getTypeMetaData ( ) const
inlineinherited
Returns
information about the types and numbers of arguments

Referenced by Vertica::ParamReader::getType(), Vertica::BlockReader::isNull(), and Vertica::BlockWriter::setNull().

◆ getTypeMetaData() [2/2]

SizedColumnTypes& Vertica::VerticaBlock::getTypeMetaData ( )
inlineinherited
Returns
information about the types and numbers of arguments

◆ getWriteableBlock()

virtual bool Vertica::PartitionWriter::getWriteableBlock ( )
virtual

Gets a writeable block of data and positions cursor at the beginning.

Reimplemented in Vertica::AnalyticPartitionWriter, and Vertica::StreamWriter.

◆ remaining()

bool Vertica::VerticaBlock::remaining ( ) const
inlineinherited
Returns
the number of entries remaining in the block

◆ resetForDataAreaFlush()

virtual void Vertica::VerticaBlock::resetForDataAreaFlush ( )
inlinevirtualinherited

Virtual method to be called when the Data Area fills up in a load. Should be called from the StreamWriter class.

Reimplemented in Vertica::StreamWriter.

◆ setInt()

void Vertica::PartitionWriter::setInt ( size_t  idx,
vint  r 
)
inline

Setter methods

◆ setNull() [1/2]

void Vertica::PartitionWriter::setNull ( size_t  idx)
inline

Set the idx'th argument to null. If a column has the canBeNull attribute set to false, then this throws an exception.

Parameters
idxThe column number in the row to set to null

◆ setNull() [2/2]

void Vertica::PartitionWriter::setNull ( size_t  idx,
bool  enforceNotNullProperty 
)
inline

Set the idx'th argument to null.

Parameters
idxThe column number in the row to set to null
enforceNotNullPropertyIf false, do not throw an exception if canBeNull is false.