C++ SDK Documentation  24.2.0
Vertica::StreamWriter Class Reference

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

Inheritance diagram for Vertica::StreamWriter:
Inheritance graph
Collaboration diagram for Vertica::StreamWriter:
Collaboration graph

Public Member Functions

 StreamWriter (size_t narg, void *udl)
 
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)
 
uint64 getTotalRowCount () const
 
const SizedColumnTypesgetTypeMetaData () const
 
SizedColumnTypesgetTypeMetaData ()
 
VUuidgetUuidRef (size_t idx)
 
const void * getVoidPtr (size_t idx=0) const
 
void * getVoidPtr (size_t idx)
 
virtual bool getWriteableBlock () __override__
 
bool next ()
 
bool remaining () const
 
virtual void resetForDataAreaFlush () __override__
 
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
 
uint64 cumulative_rows
 
int index
 
const int * indices
 
size_t ncols
 
int nrows
 
void * parent
 
std::vector< BaseDataOID > processBlockUserInfoVector
 
int pstart
 
std::vector< VStringsvWrappers
 
SizedColumnTypes typeMetaData
 
std::vector< VUuiduuWrappers
 
std::vector< VNumericvnWrappers
 

Friends

class EE::Loader::UserDefinedLoad
 

Detailed Description

Provides an iterator-based write interface over output data for a stream of blocks. 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 
)
inherited

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)
inlineinherited

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::StreamWriter::getWriteableBlock ( )
virtual

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

Reimplemented from Vertica::PartitionWriter.

◆ remaining()

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

◆ resetForDataAreaFlush()

virtual void Vertica::StreamWriter::resetForDataAreaFlush ( )
virtual

To be called when the DataArea fills up in a load. Resets the block to after the most recent full row processed, so that the writer can pick up right where it left off.

Reimplemented from Vertica::VerticaBlock.

◆ setInt()

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

Setter methods

◆ setNull() [1/2]

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

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 
)
inlineinherited

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.