C++ SDK Documentation  9.0
Vertica::ValueRangeReader Class Reference

This class represents the value ranges of the arguments of a UDSF, one range per argument. More...

Inheritance diagram for Vertica::ValueRangeReader:
Inheritance graph
Collaboration diagram for Vertica::ValueRangeReader:
Collaboration graph

Public Member Functions

 ValueRangeReader (size_t narg)
 
bool canHaveNulls (size_t idx) const
 Indicates if there can be NULL values in the range. More...
 
const vboolgetBoolPtrLo (size_t idx)
 Get a pointer to a BOOLEAN value from a range bound. More...
 
const vboolgetBoolPtrUp (size_t idx)
 
const vboolgetBoolRefLo (size_t idx)
 Get a reference to a BOOLEAN value from a range bound. More...
 
const vboolgetBoolRefUp (size_t idx)
 
template<class T , BoundType b>
const T * getColPtr (size_t idx)
 
template<class T , BoundType b>
T * getColPtrForWrite (size_t idx)
 
const DateADTgetDatePtrLo (size_t idx)
 Get a pointer to a DATE value from a range bound. More...
 
const DateADTgetDatePtrUp (size_t idx)
 
const DateADTgetDateRefLo (size_t idx)
 Get a reference to a DATE value from a range bound. More...
 
const DateADTgetDateRefUp (size_t idx)
 
const vfloatgetFloatPtrLo (size_t idx)
 Get a pointer to a FLOAT value from a range bound. More...
 
const vfloatgetFloatPtrUp (size_t idx)
 
const vfloatgetFloatRefLo (size_t idx)
 Get a reference to a FLOAT value from a range bound. More...
 
const vfloatgetFloatRefUp (size_t idx)
 
const IntervalgetIntervalPtrLo (size_t idx)
 Get a pointer to an INTERVAL value from a range bound. More...
 
const IntervalgetIntervalPtrUp (size_t idx)
 
const IntervalgetIntervalRefLo (size_t idx)
 Get a reference to an INTERVAL value from a range bound. More...
 
const IntervalgetIntervalRefUp (size_t idx)
 
const IntervalYMgetIntervalYMPtrLo (size_t idx)
 Get a pointer to a INTERVAL YEAR TO MONTH value from a range bound. More...
 
const IntervalYMgetIntervalYMPtrUp (size_t idx)
 
const IntervalYMgetIntervalYMRefLo (size_t idx)
 Get a reference to an INTERVAL YEAR TO MONTH value from a range bound. More...
 
const IntervalYMgetIntervalYMRefUp (size_t idx)
 
const vintgetIntPtrLo (size_t idx)
 Get a pointer to an INTEGER value from a range bound. More...
 
const vintgetIntPtrUp (size_t idx)
 
const vintgetIntRefLo (size_t idx)
 Get a reference to an INTEGER value from a range bound. More...
 
const vintgetIntRefUp (size_t idx)
 
const VNumericgetNumericPtrLo (size_t idx)
 Get a pointer to a VNumeric value from a range bound. More...
 
const VNumericgetNumericPtrUp (size_t idx)
 
const VNumericgetNumericRefLo (size_t idx)
 Get a reference to a VNumeric value from a range bound. More...
 
const VNumericgetNumericRefUp (size_t idx)
 
size_t getNumRanges () const
 Retrieve the number of range arguments. More...
 
const VerticaTypegetRangeType (size_t idx) const
 Returns the data type of the values in a range. More...
 
EE::ValueSort getSortedness (size_t idx) const
 Gets the sortedness of values in a range. More...
 
const VStringgetStringPtrLo (size_t idx)
 Get a pointer to a VString value from a range bound. More...
 
const VStringgetStringPtrUp (size_t idx)
 
const VStringgetStringRefLo (size_t idx)
 Get a reference to an VString value from a range bound. More...
 
const VStringgetStringRefUp (size_t idx)
 
const TimeADTgetTimePtrLo (size_t idx)
 Get a pointer to a TIME value from a range bound. More...
 
const TimeADTgetTimePtrUp (size_t idx)
 
const TimeADTgetTimeRefLo (size_t idx)
 Get a reference to a TIME value from a range bound. More...
 
const TimeADTgetTimeRefUp (size_t idx)
 
const TimestampgetTimestampPtrLo (size_t idx)
 Get a pointer to a TIMESTAMP value from a range bound. More...
 
const TimestampgetTimestampPtrUp (size_t idx)
 
const TimestampgetTimestampRefLo (size_t idx)
 Get a reference to a TIMESTAMP value from a range bound. More...
 
const TimestampgetTimestampRefUp (size_t idx)
 
const TimestampTzgetTimestampTzPtrLo (size_t idx)
 Get a pointer to a TIMESTAMP WITH TIMEZONE value from a range bound. More...
 
const TimestampTzgetTimestampTzPtrUp (size_t idx)
 
const TimestampTzgetTimestampTzRefLo (size_t idx)
 Get a reference to a TIMESTAMP WITH TIMEZONE value from a range bound. More...
 
const TimestampTzgetTimestampTzRefUp (size_t idx)
 
const TimeTzADTgetTimeTzPtrLo (size_t idx)
 Get a pointer to a TIME WITH TIMEZONE value from a range bound. More...
 
const TimeTzADTgetTimeTzPtrUp (size_t idx)
 
const TimeTzADTgetTimeTzRefLo (size_t idx)
 Get a reference to a TIME WITH TIMEZONE value from a range bound. More...
 
const TimeTzADTgetTimeTzRefUp (size_t idx)
 
const VUuidgetUuidPtrLo (size_t idx)
 Get a pointer to a VUuid value from a range bound. More...
 
const VUuidgetUuidPtrUp (size_t idx)
 
const VUuidgetUuidRefLo (size_t idx)
 Get a reference to a VUuid value from a range bound. More...
 
const VUuidgetUuidRefUp (size_t idx)
 
bool hasBounds (size_t idx) const
 Check if this range has lower and upper bounds set. More...
 
bool isNull (int idx)
 Check if all values in the idx'th input range are NULL. More...
 

Protected Types

enum  BoundType { LO_BOUND, UP_BOUND }
 

Protected Member Functions

void addArg (char *loBound, char *upBound, const VerticaType &dt, EE::ValueSort sortedness, bool canHaveNulls)
 
void setCanHaveNulls (size_t idx, bool u)
 Set a flag to indicate that some values in this range can be NULL. More...
 
void setSortedness (size_t idx, EE::ValueSort s)
 Set the sortedness of values in the range. More...
 

Protected Attributes

size_t narg
 
std::vector< ValueRangeranges
 
std::vector< VStringsvWrappersLo
 
std::vector< VStringsvWrappersUp
 
std::vector< VUuiduuWrappersLo
 
std::vector< VUuiduuWrappersUp
 
std::vector< VNumericvnWrappersLo
 
std::vector< VNumericvnWrappersUp
 

Friends

class EE::VEval
 

Detailed Description

This class represents the value ranges of the arguments of a UDSF, one range per argument.

Instances of this class are used to let UDSF developers specify the output range of UDSFs via the optional ScalarFunction::getOutputRange() function.

Member Function Documentation

void Vertica::VerticaValueRange::addArg ( char *  loBound,
char *  upBound,
const VerticaType dt,
EE::ValueSort  sortedness,
bool  canHaveNulls 
)
inlineprotectedinherited

Add a value range of a particular function argument

Parameters
loBoundBase location to find the lower bound data
upBoundBase location to find the upper bound data
sortednessSortedness of values in the range
dtThe data type of range bounds
bool Vertica::VerticaValueRange::canHaveNulls ( size_t  idx) const
inlineinherited

Indicates if there can be NULL values in the range.

Parameters
idxthe range argument number.
Returns
TRUE if some range values can be NULL, else FALSE.

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

const vbool* Vertica::ValueRangeReader::getBoolPtrLo ( size_t  idx)
inline

Get a pointer to a BOOLEAN value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
A pointer to the retrieved value cast as a BOOLEAN.
const vbool& Vertica::ValueRangeReader::getBoolRefLo ( size_t  idx)
inline

Get a reference to a BOOLEAN value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
a reference to the idx'th argument, cast as BOOLEAN.
const DateADT* Vertica::ValueRangeReader::getDatePtrLo ( size_t  idx)
inline

Get a pointer to a DATE value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
A pointer to the retrieved value cast as a DATE.
const DateADT& Vertica::ValueRangeReader::getDateRefLo ( size_t  idx)
inline

Get a reference to a DATE value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
a reference to the idx'th argument, cast as DATE.
const vfloat* Vertica::ValueRangeReader::getFloatPtrLo ( size_t  idx)
inline

Get a pointer to a FLOAT value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
A pointer to the retrieved value cast as a FLOAT.
const vfloat& Vertica::ValueRangeReader::getFloatRefLo ( size_t  idx)
inline

Get a reference to a FLOAT value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
A reference to the idx'th argument, cast as FLOAT.
const Interval* Vertica::ValueRangeReader::getIntervalPtrLo ( size_t  idx)
inline

Get a pointer to an INTERVAL value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
A pointer to the retrieved value cast as an INTERVAL.
const Interval& Vertica::ValueRangeReader::getIntervalRefLo ( size_t  idx)
inline

Get a reference to an INTERVAL value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
a reference to the idx'th argument, cast as an INTERVAL.
const IntervalYM* Vertica::ValueRangeReader::getIntervalYMPtrLo ( size_t  idx)
inline

Get a pointer to a INTERVAL YEAR TO MONTH value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
A point to the retrieved value cast as a INTERVAL YEAR TO MONTH.
const IntervalYM& Vertica::ValueRangeReader::getIntervalYMRefLo ( size_t  idx)
inline

Get a reference to an INTERVAL YEAR TO MONTH value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
a reference to the idx'th argument, cast as INTERVAL YEAR TO MONTH.
const vint* Vertica::ValueRangeReader::getIntPtrLo ( size_t  idx)
inline

Get a pointer to an INTEGER value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
a pointer to a chosen bound value, cast appropriately.

Example:

const vint *a = range->getIntPtrLo(0); // gets a pointer to the lower bound of 1st arg
const vint& Vertica::ValueRangeReader::getIntRefLo ( size_t  idx)
inline

Get a reference to an INTEGER value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
a reference to the chosen bound value, cast as INTEGER.

Example:

const vint& a = range->getIntRefUp(0); // get upper bound of the 1st range argument
const VNumeric* Vertica::ValueRangeReader::getNumericPtrLo ( size_t  idx)
inline

Get a pointer to a VNumeric value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
A pointer to the retrieved value cast as a Numeric.
const VNumeric& Vertica::ValueRangeReader::getNumericRefLo ( size_t  idx)
inline

Get a reference to a VNumeric value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
a reference to the idx'th argument, cast as VNumeric.
size_t Vertica::VerticaValueRange::getNumRanges ( ) const
inlineinherited

Retrieve the number of range arguments.

Returns
the number of range arguments held by this object.
const VerticaType& Vertica::VerticaValueRange::getRangeType ( size_t  idx) const
inlineinherited

Returns the data type of the values in a range.

Parameters
idxThe index of the range
Returns
a VerticaType object describing the data type of the range values.
EE::ValueSort Vertica::VerticaValueRange::getSortedness ( size_t  idx) const
inlineinherited

Gets the sortedness of values in a range.

Parameters
idxthe range argument number.
Returns
the range sortedness. Possible values are: EE::SORT_UNORDERED - Unsorted EE::SORT_MONOTONIC_INCREASING - Ascending EE::SORT_MONOTONIC_DECREASING - Descending EE::SORT_CONSTANT - Single value

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

const VString* Vertica::ValueRangeReader::getStringPtrLo ( size_t  idx)
inline

Get a pointer to a VString value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
A pointer to the retrieved value cast as a VString.
const VString& Vertica::ValueRangeReader::getStringRefLo ( size_t  idx)
inline

Get a reference to an VString value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
a reference to the idx'th argument, cast as VString.
Note
the returned object is a variable-length prefix of the actual string values in the range. For example, if the range values are {'abc', 'abb', 'bc', 'cab'} the range bounds may be like: Lo='a' and Up='cb'. In the example, the upper bound is not even a prefix of any value in the range, but all values in the range are greater than or equal than Lo and less than or equal to Up.
const TimeADT* Vertica::ValueRangeReader::getTimePtrLo ( size_t  idx)
inline

Get a pointer to a TIME value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
A pointer to the retrieved value cast as a TIME.
const TimeADT& Vertica::ValueRangeReader::getTimeRefLo ( size_t  idx)
inline

Get a reference to a TIME value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
a reference to the idx'th argument, cast as TIME.
const Timestamp* Vertica::ValueRangeReader::getTimestampPtrLo ( size_t  idx)
inline

Get a pointer to a TIMESTAMP value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
A pointer to the retrieved value cast as a TIMESTAMP.
const Timestamp& Vertica::ValueRangeReader::getTimestampRefLo ( size_t  idx)
inline

Get a reference to a TIMESTAMP value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
a reference to the idx'th argument, cast as TIMESTAMP.
const TimestampTz* Vertica::ValueRangeReader::getTimestampTzPtrLo ( size_t  idx)
inline

Get a pointer to a TIMESTAMP WITH TIMEZONE value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
A pointer to the retrieved value cast as a TIMESTAMP WITH TIMEZONE.
const TimestampTz& Vertica::ValueRangeReader::getTimestampTzRefLo ( size_t  idx)
inline

Get a reference to a TIMESTAMP WITH TIMEZONE value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
a reference to the idx'th argument, cast as TIMESTAMP WITH TIMEZONE.
const TimeTzADT* Vertica::ValueRangeReader::getTimeTzPtrLo ( size_t  idx)
inline

Get a pointer to a TIME WITH TIMEZONE value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
A pointer to the retrieved value cast as a TIME WITH TIMEZONE.
const TimeTzADT& Vertica::ValueRangeReader::getTimeTzRefLo ( size_t  idx)
inline

Get a reference to a TIME WITH TIMEZONE value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
a reference to the idx'th argument, cast as TIME WITH TIMEZONE.
const VUuid* Vertica::ValueRangeReader::getUuidPtrLo ( size_t  idx)
inline

Get a pointer to a VUuid value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
A pointer to the retrieved value cast as a Uuid.
const VUuid& Vertica::ValueRangeReader::getUuidRefLo ( size_t  idx)
inline

Get a reference to a VUuid value from a range bound.

Parameters
idxThe argument number to retrieve the range bound.
Returns
a reference to the idx'th argument, cast as VUuid.
bool Vertica::ValueRangeReader::hasBounds ( size_t  idx) const
inline

Check if this range has lower and upper bounds set.

Note
Callers of the get reference or get pointer functions should always first call this method, and only access the range bounds when this function returns TRUE.

Example:

if (rangeReader.hasBounds(0)) { // Check if bounds of the 1st range argument are set
// OK to access bounds
const vint& i = rangeReader.getIntRefLo(0);
const vint& j = rangeReader.getIntRefUp(0);
}
Returns
TRUE if the range bounds are safe to access, else FALSE.
bool Vertica::ValueRangeReader::isNull ( int  idx)
inline

Check if all values in the idx'th input range are NULL.

Parameters
idxThe argument range number.
Returns
true if all values in the range are NULL, false otherwise.
void Vertica::VerticaValueRange::setCanHaveNulls ( size_t  idx,
bool  u 
)
inlineprotectedinherited

Set a flag to indicate that some values in this range can be NULL.

Parameters
idxThe argument range number.
utrue if there can be NULL values in the range, else false.

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

void Vertica::VerticaValueRange::setSortedness ( size_t  idx,
EE::ValueSort  s 
)
inlineprotectedinherited

Set the sortedness of values in the range.

Parameters
idxThe range argument number.
sThe sortedness value to set. Possible values are: EE::SORT_UNORDERED - Unsorted EE::SORT_MONOTONIC_INCREASING - Ascending EE::SORT_MONOTONIC_DECREASING - Descending EE::SORT_CONSTANT - Single value

Example:

range.setSortedness(0, EE:SORT_CONSTANT); // defines a single-valued range

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