Vertica::ValueRangeReader Class Reference

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

Inheritance diagram for Vertica::ValueRangeReader:

Collaboration diagram for Vertica::ValueRangeReader:

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.
const vbool * getBoolPtrLo (size_t idx) const
Get a pointer to a BOOLEAN value from a range bound.
const vbool * getBoolPtrUp (size_t idx) const
const vbool & getBoolRefLo (size_t idx) const
Get a reference to a BOOLEAN value from a range bound.
const vbool & getBoolRefUp (size_t idx) const
template
const T * getColPtr (size_t idx) const
template
T * getColPtrForWrite (size_t idx)
const DateADT * getDatePtrLo (size_t idx) const
Get a pointer to a DATE value from a range bound.
const DateADT * getDatePtrUp (size_t idx) const
const DateADT & getDateRefLo (size_t idx) const
Get a reference to a DATE value from a range bound.
const DateADT & getDateRefUp (size_t idx) const
const vfloat * getFloatPtrLo (size_t idx) const
Get a pointer to a FLOAT value from a range bound.
const vfloat * getFloatPtrUp (size_t idx) const
const vfloat & getFloatRefLo (size_t idx) const
Get a reference to a FLOAT value from a range bound.
const vfloat & getFloatRefUp (size_t idx) const
const Interval * getIntervalPtrLo (size_t idx) const
Get a pointer to an INTERVAL value from a range bound.
const Interval * getIntervalPtrUp (size_t idx) const
const Interval & getIntervalRefLo (size_t idx) const
Get a reference to an INTERVAL value from a range bound.
const Interval & getIntervalRefUp (size_t idx) const
const IntervalYM * getIntervalYMPtrLo (size_t idx) const
Get a pointer to a INTERVAL YEAR TO MONTH value from a range bound.
const IntervalYM * getIntervalYMPtrUp (size_t idx) const
const IntervalYM & getIntervalYMRefLo (size_t idx) const
Get a reference to an INTERVAL YEAR TO MONTH value from a range bound.
const IntervalYM & getIntervalYMRefUp (size_t idx) const
const vint * getIntPtrLo (size_t idx) const
Get a pointer to an INTEGER value from a range bound.
const vint * getIntPtrUp (size_t idx) const
const vint & getIntRefLo (size_t idx) const
Get a reference to an INTEGER value from a range bound.
const vint & getIntRefUp (size_t idx) const
const VNumeric * getNumericPtrLo (size_t idx) const
Get a pointer to a VNumeric value from a range bound.
const VNumeric * getNumericPtrUp (size_t idx) const
const VNumeric & getNumericRefLo (size_t idx) const
Get a reference to a VNumeric value from a range bound.
const VNumeric & getNumericRefUp (size_t idx) const
size_t getNumRanges () const
Retrieve the number of range arguments.
const VerticaType & getRangeType (size_t idx) const
Returns the data type of the values in a range.
EE::ValueSort getSortedness (size_t idx) const
const VString * getStringPtrLo (size_t idx) const
Get a pointer to a VString value from a range bound.
const VString * getStringPtrUp (size_t idx) const
const VString & getStringRefLo (size_t idx) const
Get a reference to an VString value from a range bound.
const VString & getStringRefUp (size_t idx) const
const TimeADT * getTimePtrLo (size_t idx) const
Get a pointer to a TIME value from a range bound.
const TimeADT * getTimePtrUp (size_t idx) const
const TimeADT & getTimeRefLo (size_t idx) const
Get a reference to a TIME value from a range bound.
const TimeADT & getTimeRefUp (size_t idx) const
const Timestamp * getTimestampPtrLo (size_t idx) const
Get a pointer to a TIMESTAMP value from a range bound.
const Timestamp * getTimestampPtrUp (size_t idx) const
const Timestamp & getTimestampRefLo (size_t idx) const
Get a reference to a TIMESTAMP value from a range bound.
const Timestamp & getTimestampRefUp (size_t idx) const
const TimestampTz * getTimestampTzPtrLo (size_t idx) const
Get a pointer to a TIMESTAMP WITH TIMEZONE value from a range bound.
const TimestampTz * getTimestampTzPtrUp (size_t idx) const
const TimestampTz & getTimestampTzRefLo (size_t idx) const
Get a reference to a TIMESTAMP WITH TIMEZONE value from a range bound.
const TimestampTz & getTimestampTzRefUp (size_t idx) const
const TimeTzADT * getTimeTzPtrLo (size_t idx) const
Get a pointer to a TIME WITH TIMEZONE value from a range bound.
const TimeTzADT * getTimeTzPtrUp (size_t idx) const
const TimeTzADT & getTimeTzRefLo (size_t idx) const
Get a reference to a TIME WITH TIMEZONE value from a range bound.
const TimeTzADT & getTimeTzRefUp (size_t idx) const
const VUuid * getUuidPtrLo (size_t idx) const
Get a pointer to a VUuid value from a range bound.
const VUuid * getUuidPtrUp (size_t idx) const
const VUuid & getUuidRefLo (size_t idx) const
Get a reference to a VUuid value from a range bound.
const VUuid & getUuidRefUp (size_t idx) const
bool hasBounds (size_t idx) const
Check if this range has lower and upper bounds set.
bool isNull (int idx) const
Check if all values in the idx'th input range are NULL.
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.
void setSortedness (size_t idx, EE::ValueSort s)
Protected Attributes
size_t narg
std::vector ranges
std::vector svWrappersLo
std::vector svWrappersUp
std::vector uuWrappersLo
std::vector uuWrappersUp
std::vector vnWrappersLo
std::vector vnWrappersUp
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

  • loBound: Base location to find the lower bound data
  • upBound: Base location to find the upper bound data
  • sortedness: Sortedness of values in the range
  • dt: The data type of range bounds
bool Vertica::VerticaValueRange::canHaveNulls(size_t idx) const

inline inherited Indicates if there can be NULL values in the range.

Parameters

  • idx: the 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

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

inline inherited Returns the data type of the values in a range.

Parameters

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The 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

  • idx: The argument range number.
  • u: true if there can be NULL values in the range, else false.