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

enum  BoundType { LO_BOUND, UP_BOUND }
 

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

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)
 

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.
const vbool* Vertica::ValueRangeReader::getBoolPtrLo ( size_t  idx) const
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.

Referenced by getBoolRefLo().

const vbool& Vertica::ValueRangeReader::getBoolRefLo ( size_t  idx) const
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.

Referenced by isNull().

const DateADT* Vertica::ValueRangeReader::getDatePtrLo ( size_t  idx) const
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.

Referenced by getDateRefLo().

const DateADT& Vertica::ValueRangeReader::getDateRefLo ( size_t  idx) const
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.

Referenced by isNull().

const vfloat* Vertica::ValueRangeReader::getFloatPtrLo ( size_t  idx) const
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.

Referenced by getFloatRefLo().

const vfloat& Vertica::ValueRangeReader::getFloatRefLo ( size_t  idx) const
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.

Referenced by isNull().

const Interval* Vertica::ValueRangeReader::getIntervalPtrLo ( size_t  idx) const
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.

Referenced by getIntervalRefLo().

const Interval& Vertica::ValueRangeReader::getIntervalRefLo ( size_t  idx) const
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.

Referenced by isNull().

const IntervalYM* Vertica::ValueRangeReader::getIntervalYMPtrLo ( size_t  idx) const
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.

Referenced by getIntervalYMRefLo().

const IntervalYM& Vertica::ValueRangeReader::getIntervalYMRefLo ( size_t  idx) const
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.

Referenced by isNull().

const vint* Vertica::ValueRangeReader::getIntPtrLo ( size_t  idx) const
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

Referenced by getIntRefLo().

const vint& Vertica::ValueRangeReader::getIntRefLo ( size_t  idx) const
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

Referenced by isNull().

const VNumeric* Vertica::ValueRangeReader::getNumericPtrLo ( size_t  idx) const
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.

Referenced by getNumericRefLo().

const VNumeric& Vertica::ValueRangeReader::getNumericRefLo ( size_t  idx) const
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.

Referenced by isNull().

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.
const VString* Vertica::ValueRangeReader::getStringPtrLo ( size_t  idx) const
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.

Referenced by getStringRefLo().

const VString& Vertica::ValueRangeReader::getStringRefLo ( size_t  idx) const
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.

Referenced by isNull().

const TimeADT* Vertica::ValueRangeReader::getTimePtrLo ( size_t  idx) const
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.

Referenced by getTimeRefLo().

const TimeADT& Vertica::ValueRangeReader::getTimeRefLo ( size_t  idx) const
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.

Referenced by isNull().

const Timestamp* Vertica::ValueRangeReader::getTimestampPtrLo ( size_t  idx) const
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.

Referenced by getTimestampRefLo().

const Timestamp& Vertica::ValueRangeReader::getTimestampRefLo ( size_t  idx) const
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.

Referenced by isNull().

const TimestampTz* Vertica::ValueRangeReader::getTimestampTzPtrLo ( size_t  idx) const
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.

Referenced by getTimestampTzRefLo().

const TimestampTz& Vertica::ValueRangeReader::getTimestampTzRefLo ( size_t  idx) const
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.

Referenced by isNull().

const TimeTzADT* Vertica::ValueRangeReader::getTimeTzPtrLo ( size_t  idx) const
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.

Referenced by getTimeTzRefLo().

const TimeTzADT& Vertica::ValueRangeReader::getTimeTzRefLo ( size_t  idx) const
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.

Referenced by isNull().

const VUuid* Vertica::ValueRangeReader::getUuidPtrLo ( size_t  idx) const
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.

Referenced by getUuidRefLo().

const VUuid& Vertica::ValueRangeReader::getUuidRefLo ( size_t  idx) const
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.

Referenced by isNull().

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