Vertica::BlockWriter Class Reference

Iterator interface for writing rows to a Vertica block.

Inheritance diagram for Vertica::BlockWriter:

Collaboration diagram for Vertica::BlockWriter:

Public Member Functions
BlockWriter (int rowcount)
BlockWriter (char *outArr, int stride, int rowcount, const int *indices, const VerticaType &dt)
int capacity () const
void copy (const VerticaBlock &other)
void copyFromInput (size_t dstIdx, const BlockReader &vblock, size_t srcIdx)
void copyFromInput (const BlockReader &vblock)
Array::ArrayWriter getArrayRef (size_t idx=0)
Get a handle for writing an output array value.
template
const T * getColPtr (size_t idx) const
template<>
const VString * getColPtr (size_t idx) const
template<>
const VNumeric * getColPtr (size_t idx) const
template<>
const VUuid * getColPtr (size_t idx) const
template<>
const BlockReader * getColPtr (size_t idx) const
template
T * getColPtrForWrite (size_t idx)
template<>
VString * getColPtrForWrite (size_t idx)
template<>
VNumeric * getColPtrForWrite (size_t idx)
template<>
VUuid * getColPtrForWrite (size_t idx)
template<>
BlockWriter * getColPtrForWrite (size_t idx)
template
const T & getColRef (size_t idx) const
template
T & getColRefForWrite (size_t idx)
int getColStride (size_t idx) const
const EE::DataArea * getDataArea (size_t idx) const
size_t getNumCols () const
VNumeric & getNumericRef (size_t idx=0)
Allocates a new VNumeric object to use as output.
int getNumRows () const
BlockWriter * getRowPtr (size_t idx=0)
Get a pointer for writing an output Row value.
BlockWriter & getRowRef (size_t idx=0)
Get a reference for writing an output Row value.
int getRowsWritten () const
VString * getStringPtr (size_t idx=0)
Get a pointer for writing output.
VString & getStringRef (size_t idx=0)
Allocates a new VString object to use as output.
const SizedColumnTypes & getTypeMetaData () const
SizedColumnTypes & getTypeMetaData ()
VUuid & getUuidRef (size_t idx=0)
Allocates a new VUuid object to use as output.
void * getVoidPtr (size_t idx=0)
const void * getVoidPtr (size_t idx=0) const
bool hasMoreSpace () const
bool next ()
Complete writing this row of output and move to the next row.
bool remaining () const
virtual void resetForDataAreaFlush ()
void setBool (vbool r)
Adds a BOOLEAN value to the output row.
void setBool (size_t idx, vbool r)
Adds a BOOLEAN value to the indicated column of the output row.
void setDataArea (size_t idx, void *dataarea)
void setDate (DateADT r)
Adds a DATE value to the output row.
void setDate (size_t idx, DateADT r)
Adds a DATE value to the indicated column of the output row.
void setFloat (vfloat r)
Adds a FLOAT value to the output row.
void setFloat (size_t idx, vfloat r)
Adds a FLOAT value to the indicated column of the output row.
void setInt (vint r)
Adds an INTEGER value to the output row.
void setInt (size_t idx, vint r)
Adds an INTEGER value to the indicated column of the output row.
void setInterval (Interval r)
Adds an INTERVAL value to the output row.
void setInterval (size_t idx, Interval r)
Adds an INTERVAL value to the indicated column of the output row.
void setIntervalYM (IntervalYM r)
Adds an INTERVAL YEAR TO MONTH value to the output row.
void setIntervalYM (size_t idx, IntervalYM r)
Adds an INTERVAL YEAR TO MONTH value to the indicated column of the output row.
void setNull (size_t idx=0, bool enforceNotNullProperty=true)
Set the column to null.
void setTime (TimeADT r)
Adds a TIME value to the output row.
void setTime (size_t idx, TimeADT r)
Adds an TIME value to the indicated column of the output row.
void setTimestamp (Timestamp r)
Adds a TIMESTAMP value to the output row.
void setTimestamp (size_t idx, Timestamp r)
Adds an TIMESTAMP value to the indicated column of the output row.
void setTimestampTz (TimestampTz r)
Adds a TIMESTAMP WITH TIMEZONE value to the output row.
void setTimestampTz (size_t idx, TimestampTz r)
Adds an TIMESTAMP WITH TIMEZONE value to the indicated column of the output row.
void setTimeTz (TimeTzADT r)
Adds a TIME WITH TIMEZONE value to the output row.
void setTimeTz (size_t idx, TimeTzADT r)
Adds an TIME WITH TIMEZONE value to the indicated column of the output row.
void throwIncorrectUsageError ()
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
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
std::vector cols
std::vector colstrides
int count
std::vector ctWrappers
int index
const int * indices
size_t ncols
int nrows
std::vector processBlockUserInfoVector
std::vector svWrappers
SizedColumnTypes typeMetaData
std::vector uuWrappers
std::vector vnWrappers
Friends
class Array::ArrayWriter
class EE::VEval
class PartitionWriter

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

addCol()

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

protected inherited Add the location for reading a particular argument.

Parameters

  • arg: The base location to find data.
  • colstride: The stride between data instances.
  • field: metadata for the added column
  • dt: The type of input.
  • fieldname: the name of the field

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

copyFromInput() [1/2]

void Vertica::BlockWriter::copyFromInput(size_t dstIdx, const BlockReader & vblock, 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

  • dstIdx: The destination column index in the output writer (this)
  • vblock: The source data block
  • srcIdx: The source column index in the input reader

Referenced by

copyFromInput() [2/2]

void Vertica::BlockWriter::copyFromInput(const BlockReader & vblock)

inline Copy all columns from the source block to this block

getArrayIntermediateDataArea()

EE::DataArea** Vertica::VerticaBlock::getArrayIntermediateDataArea(size_t c)

inlineprotectedinherited

Returns a pointer to a DataArea for accumulating an intermediate result

getArrayRef()

Array::ArrayWriter Vertica::BlockWriter::getArrayRef(size_t idx = 0)

Get a handle for writing an output array value.

Parameters

  • idx: the output column

Returns a handle for writing array elements

getColPtr()

template<class T >
const T* Vertica::VerticaBlock::getColPtr(size_t idx) const

inline inherited Returns a pointer to the idx'th argument, cast appropriately.

Example:

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

getColRef()

template<class T >
const T& Vertica::VerticaBlock::getColRef(size_t idx) const

inline inherited 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

inline inherited Returns the number of columns held by this block.

Referenced by

getNumericRef()

VNumeric& Vertica::BlockWriter::getNumericRef(size_t idx = 0)

inline Allocates a new VNumeric object to use as output.

Parameters

  • idx: the column to reference (default 0)

Returns A new VNumeric object to hold output. This object automatically added to the output row in the indicated column

Referenced by setNull().

getNumRows()

int Vertica::VerticaBlock::getNumRows() const

inline inherited Returns the number of rows held by this block.

getRowPtr()

BlockWriter* Vertica::BlockWriter::getRowPtr(size_t idx = 0)

inline Get a pointer for writing an output Row value.

Parameters

  • idx: the output column

Returns a pointer to a BlockWriter which holds output data for the Row value's fields

getRowRef()

BlockWriter& Vertica::BlockWriter::getRowRef(size_t idx = 0)

inline Get a reference for writing an output Row value.

Parameters

  • idx: the output column

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

Referenced by

getStringPtr()

VString* Vertica::BlockWriter::getStringPtr(size_t idx = 0)

inline Get a pointer for writing output.

Parameters

  • idx: the output column

Returns A new VString object to hold output. This object automatically added to the output row in the indicated column

getStringRef()

VString& Vertica::BlockWriter::getStringRef(size_t idx = 0)

inline Allocates a new VString object to use as output.

Parameters

  • idx: the column to reference (default 0)

Returns A new VString object to hold output. This object is automatically added to the output row in the indicated column

Referenced by

getTypeMetaData() [1/2]

const SizedColumnTypes& Vertica::VerticaBlock::getTypeMetaData() const

inline inherited Returns information about the types and numbers of arguments

Referenced by

getTypeMetaData() [2/2]

SizedColumnTypes& Vertica::VerticaBlock::getTypeMetaData()

inline inherited Returns information about the types and numbers of arguments

getUuidRef()

VUuid& Vertica::BlockWriter::getUuidRef(size_t idx = 0)

inline Allocates a new VUuid object to use as output.

Parameters

  • idx: the column to reference (default 0)

Returns A new VUuid object to hold output. This object automatically added to the output row in the indicated column

Referenced by setNull().

next()

bool Vertica::BlockWriter::next()

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

Referenced by Vertica::copyBlockColumn().

remaining()

bool Vertica::VerticaBlock::remaining() const

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

setBool() [1/2]

void Vertica::BlockWriter::setBool(vbool r)

inline Adds a BOOLEAN value to the output row.

Parameters

  • r: The BOOLEAN value to insert into the output row.

Referenced by setNull().

setBool() [2/2]

void Vertica::BlockWriter::setBool(size_t idx, vbool r)

inline Adds a BOOLEAN value to the indicated column of the output row.

Parameters

  • idx: the column index
  • r: the BOOLEAN value to insert

setDate() [1/2]

void Vertica::BlockWriter::setDate(DateADT r)

inline Adds a DATE value to the output row.

Parameters

  • r: The DATE value to insert into the output row.

Referenced by setNull().

setDate() [2/2]

void Vertica::BlockWriter::setDate(size_t idx, DateADT r)

inline Adds a DATE value to the indicated column of the output row.

Parameters

  • idx: the column index
  • r: the DATE value to insert

setFloat() [1/2]

void Vertica::BlockWriter::setFloat(vfloat r)

inline Adds a FLOAT value to the output row.

Parameters

  • r: The FLOAT value to insert into the output row.

Referenced by setNull().

setFloat() [2/2]

void Vertica::BlockWriter::setFloat(size_t idx, vfloat r)

inline Adds a FLOAT value to the indicated column of the output row.

Parameters

  • idx: the column index
  • r: the FLOAT value to insert

setInt() [1/2]

void Vertica::BlockWriter::setInt(vint r)

inline Adds an INTEGER value to the output row.

Setter methods

Parameters

  • r: The INTEGER value to insert into the output row.

Referenced by setNull().

setInt() [2/2]

void Vertica::BlockWriter::setInt(size_t idx, vint r)

inline Adds an INTEGER value to the indicated column of the output row.

Parameters

  • idx: the column index
  • r: the INTEGER value to insert

setInterval() [1/2]

void Vertica::BlockWriter::setInterval(Interval r)

inline Adds an INTERVAL value to the output row.

Parameters

  • r: The INTERVAL value to insert into the output row.

Referenced by setNull().

setInterval() [2/2]

void Vertica::BlockWriter::setInterval(size_t idx, Interval r)

inline Adds an INTERVAL value to the indicated column of the output row.

Parameters

  • idx: the column index
  • r: the INTERVAL value to insert

setIntervalYM() [1/2]

void Vertica::BlockWriter::setIntervalYM(IntervalYM r)

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

Parameters

  • r: The INTERVAL YEAR TO MONTH value to insert into the output row.

Referenced by setNull().

setIntervalYM() [2/2]

void Vertica::BlockWriter::setIntervalYM(size_t idx, IntervalYM r)

inline Adds an INTERVAL YEAR TO MONTH value to the indicated column of the output row.

Parameters

  • idx: the column index
  • r: the INTERVAL YEAR TO MONTH value to insert

setNull()

void Vertica::BlockWriter::setNull(size_t idx = 0, bool enforceNotNullProperty = true)

inline Set the column to null.

Parameters

  • idx: The column number in the row to set to null
  • enforceNotNullProperty: if true, raise an error if the target field has the canBeNull property set to false.

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

setTime() [1/2]

void Vertica::BlockWriter::setTime(TimeADT r)

inline Adds a TIME value to the output row.

Parameters

  • r: The TIME value to insert into the output row.

Referenced by setNull().

setTime() [2/2]

void Vertica::BlockWriter::setTime(size_t idx, TimeADT r)

inline Adds an TIME value to the indicated column of the output row.

Parameters

  • idx: the column index
  • r: the TIME value to insert

setTimestamp() [1/2]

void Vertica::BlockWriter::setTimestamp(Timestamp r)

inline Adds a TIMESTAMP value to the output row.

Parameters

  • r: The TIMESTAMP value to insert into the output row.

Referenced by setNull().

setTimestamp() [2/2]

void Vertica::BlockWriter::setTimestamp(size_t idx, Timestamp r)

inline Adds an TIMESTAMP value to the indicated column of the output row.

Parameters

  • idx: the column index
  • r: the TIMESTAMP value to insert

setTimestampTz() [1/2]

void Vertica::BlockWriter::setTimestampTz(TimestampTz r)

inline Adds a TIMESTAMP WITH TIMEZONE value to the output row.

Parameters

  • r: The TIMESTAMP WITH TIMEZONE value to insert into the output row.

Referenced by setNull().

setTimestampTz() [2/2]

void Vertica::BlockWriter::setTimestampTz(size_t idx, TimestampTz r)

inline Adds an TIMESTAMP WITH TIMEZONE value to the indicated column of the output row.

Parameters

  • idx: the column index
  • r: the TIMESTAMP WITH TIMEZONE value to insert

setTimeTz() [1/2]

void Vertica::BlockWriter::setTimeTz(TimeTzADT r)

inline Adds a TIME WITH TIMEZONE value to the output row.

Parameters

  • r: The TIME WITH TIMEZONE value to insert into the output row.

Referenced by setNull().

setTimeTz() [2/2]

void Vertica::BlockWriter::setTimeTz(size_t idx, TimeTzADT r)

inline Adds an TIME WITH TIMEZONE value to the indicated column of the output row.

Parameters

  • idx: the column index
  • r: the TIME WITH TIMEZONE value to insert