C++ SDK Documentation  11.0.1
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
 
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

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

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().

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)
EE::DataArea** Vertica::VerticaBlock::getArrayIntermediateDataArea ( size_t  c)
inlineprotectedinherited
Returns
a pointer to a DataArea for accumulating an intermediate result

Referenced by Vertica::BlockWriter::getArrayRef().

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

size_t Vertica::VerticaBlock::getNumCols ( ) const
inlineinherited
int Vertica::VerticaBlock::getNumRows ( ) const
inlineinherited
Returns
the number of rows held by this block.
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
const SizedColumnTypes& Vertica::VerticaBlock::getTypeMetaData ( ) const
inlineinherited
SizedColumnTypes& Vertica::VerticaBlock::getTypeMetaData ( )
inlineinherited
Returns
information about the types and numbers of arguments
virtual bool Vertica::StreamWriter::getWriteableBlock ( )
virtual

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

Reimplemented from Vertica::PartitionWriter.

bool Vertica::VerticaBlock::remaining ( ) const
inlineinherited
Returns
the number of entries remaining in the block
void Vertica::PartitionWriter::setInt ( size_t  idx,
vint  r 
)
inlineinherited

Setter methods

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
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.