C++ SDK Documentation  10.0.1
Vertica::BlockWriter Class Reference

Iterator interface for writing rows to a Vertica block. More...

Inheritance diagram for Vertica::BlockWriter:
Inheritance graph
Collaboration diagram for Vertica::BlockWriter:
Collaboration graph

Public Member Functions

 BlockWriter (int rowcount)
 
 BlockWriter (char *outArr, int stride, int rowcount, const int *indices, const VerticaType &dt)
 
void copy (const VerticaBlock &other)
 
VStringgetArrayRef ()
 Allocates a new VArray object to use as output. More...
 
template<class T >
const T * getColPtr (size_t idx) const
 
template<>
const VStringgetColPtr (size_t idx) const
 
template<>
const VNumeric * getColPtr (size_t idx) const
 
template<>
const VUuidgetColPtr (size_t idx) const
 
template<class T >
T * getColPtrForWrite (size_t idx)
 
template<>
VStringgetColPtrForWrite (size_t idx)
 
template<>
VNumeric * getColPtrForWrite (size_t idx)
 
template<>
VUuidgetColPtrForWrite (size_t idx)
 
template<class T >
const T & getColRef (size_t idx)
 
template<class T >
T & getColRefForWrite (size_t idx)
 
int getColStride (size_t idx) const
 
const EE::DataAreagetDataArea (size_t idx)
 
size_t getNumCols () const
 
VNumeric & getNumericRef ()
 Allocates a new VNumeric object to use as output. More...
 
int getNumRows () const
 
VStringgetStringPtr ()
 Get a pointer for writing output. More...
 
VStringgetStringRef ()
 Allocates a new VString object to use as output. More...
 
const SizedColumnTypesgetTypeMetaData () const
 
SizedColumnTypesgetTypeMetaData ()
 
VUuidgetUuidRef ()
 Allocates a new VUuid object to use as output. More...
 
void * getVoidPtr ()
 
void next ()
 Complete writing this row of output and move to the next row. More...
 
bool remaining ()
 
void setBool (vbool r)
 Adds a BOOLEAN value to the output row. More...
 
void setDataArea (size_t idx, void *dataarea)
 
void setDate (DateADT r)
 Adds a BOOLEAN value to the output row. More...
 
void setFloat (vfloat r)
 Adds a FLOAT value to the output row. More...
 
void setInt (vint r)
 Adds an INTEGER value to the output row. More...
 
void setInterval (Interval r)
 Adds an INTERVAL value to the output row. More...
 
void setIntervalYM (IntervalYM r)
 Adds an INTERVAL YEAR TO MONTH value to the output row. More...
 
void setNull ()
 Set the column to null. More...
 
void setTime (TimeADT r)
 Adds a TIMESTAMP value to the output row. More...
 
void setTimestamp (Timestamp r)
 Adds a TIMESTAMP value to the output row. More...
 
void setTimestampTz (TimestampTz r)
 Adds a TIMESTAMP WITH TIMEZONE value to the output row. More...
 
void setTimeTz (TimeTzADT r)
 Adds a TIMESTAMP WITH TIMEZONE value to the output row. More...
 
void throwInCorrectUsageError ()
 

Protected Member Functions

void addCol (char *arg, int colstride, const VerticaType &dt, const std::string fieldName="")
 
void addCol (const char *arg, int colstride, const VerticaType &dt, const std::string fieldName="")
 
bool checkStringUserBlockInfo (size_t idx) const
 
bool checkTimeUserBlockInfo (size_t idx) const
 
void reset ()
 
void resetIndex ()
 
void setRowCount (int rowCount)
 
void validateStringColumn (size_t idx, const VString &s, size_t colLength) const
 

Protected Attributes

std::vector< char * > cols
 
std::vector< int > colstrides
 
int count
 
int index
 
const int * indices
 
size_t ncols
 
int nrows
 
std::vector< BaseDataOID > processBlockUserInfoVector
 
std::vector< VStringsvWrappers
 
SizedColumnTypes typeMetaData
 
std::vector< VUuiduuWrappers
 
std::vector< VNumeric > vnWrappers
 

Friends

class Array::ScopedSeek
 
class EE::VEval
 

Detailed Description

Iterator interface for writing rows to a Vertica block.

This class provides the output rows that ScalarFunction.processBlock() writes to.

Member Function Documentation

void Vertica::VerticaBlock::addCol ( char *  arg,
int  colstride,
const VerticaType dt,
const std::string  fieldName = "" 
)
inlineprotectedinherited

Add the location for reading a particular argument.

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

Referenced by Vertica::ParamWriter::setAllocator().

VString& Vertica::BlockWriter::getArrayRef ( )
inline

Allocates a new VArray object to use as output.

Returns
A new VArray object to hold output. This object is automatically added to the output row.
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);

Referenced by Vertica::PartitionWriter::copyFromInput().

template<class T >
const T& Vertica::VerticaBlock::getColRef ( size_t  idx)
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
Returns
the number of columns held by this block.
VNumeric& Vertica::BlockWriter::getNumericRef ( )
inline

Allocates a new VNumeric object to use as output.

Returns
A new VNumeric object to hold output. This object automatically added to the output row.
int Vertica::VerticaBlock::getNumRows ( ) const
inlineinherited
Returns
the number of rows held by this block.
VString* Vertica::BlockWriter::getStringPtr ( )
inline

Get a pointer for writing output.

Returns
A new VString object to hold output. This object automatically added to the output row.
VString& Vertica::BlockWriter::getStringRef ( )
inline

Allocates a new VString object to use as output.

Returns
A new VString object to hold output. This object is automatically added to the output row.
const SizedColumnTypes& Vertica::VerticaBlock::getTypeMetaData ( ) const
inlineinherited
Returns
information about the types and numbers of arguments

Referenced by Vertica::PartitionWriter::copyFromInput().

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

Allocates a new VUuid object to use as output.

Returns
A new VUuid object to hold output. This object automatically added to the output row.
void Vertica::BlockWriter::next ( )
inline

Complete writing this row of output and move to the next row.

bool Vertica::VerticaBlock::remaining ( )
inlineinherited
Returns
the number of entries remaining in the block
void Vertica::BlockWriter::setBool ( vbool  r)
inline

Adds a BOOLEAN value to the output row.

Parameters
rThe BOOLEAN value to insert into the output row.
void Vertica::BlockWriter::setDate ( DateADT  r)
inline

Adds a BOOLEAN value to the output row.

Parameters
rThe BOOLEAN value to insert into the output row.
void Vertica::BlockWriter::setFloat ( vfloat  r)
inline

Adds a FLOAT value to the output row.

Parameters
rThe FLOAT value to insert into the output row.
void Vertica::BlockWriter::setInt ( vint  r)
inline

Adds an INTEGER value to the output row.

Setter methods

Parameters
rThe INTEGER value to insert into the output row.
void Vertica::BlockWriter::setInterval ( Interval  r)
inline

Adds an INTERVAL value to the output row.

Parameters
rThe INTERVAL value to insert into the output row.
void Vertica::BlockWriter::setIntervalYM ( IntervalYM  r)
inline

Adds an INTERVAL YEAR TO MONTH value to the output row.

Parameters
rThe INTERVAL YEAR TO MONTH value to insert into the output row.
void Vertica::BlockWriter::setNull ( )
inline

Set the column to null.

Parameters
idxThe column number in the row to set to null
void Vertica::BlockWriter::setTime ( TimeADT  r)
inline

Adds a TIMESTAMP value to the output row.

Parameters
rThe TIMESTAMP value to insert into the output row.
void Vertica::BlockWriter::setTimestamp ( Timestamp  r)
inline

Adds a TIMESTAMP value to the output row.

Parameters
rThe TIMESTAMP value to insert into the output row.
void Vertica::BlockWriter::setTimestampTz ( TimestampTz  r)
inline

Adds a TIMESTAMP WITH TIMEZONE value to the output row.

Parameters
rThe TIMESTAMP WITH TIMEZONE value to insert into the output row.
void Vertica::BlockWriter::setTimeTz ( TimeTzADT  r)
inline

Adds a TIMESTAMP WITH TIMEZONE value to the output row.

Parameters
rThe TIMESTAMP WITH TIMEZONE value to insert into the output row.