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

This class represents value ranges used in analyzing the output of UDSFs. A range is expressed as a minimum/maximum value (inclusive) pair. More...

Inheritance diagram for Vertica::VerticaValueRange:
Inheritance graph
Collaboration diagram for Vertica::VerticaValueRange:
Collaboration graph

Classes

struct  ValueRange
 

Public Member Functions

 VerticaValueRange (size_t narg)
 
bool canHaveNulls (size_t idx) const
 Indicates if there can be NULL values in the range. More...
 
template<class T , BoundType b>
const T * getColPtr (size_t idx)
 
template<class T , BoundType b>
T * getColPtrForWrite (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...
 

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
 

Detailed Description

This class represents value ranges used in analyzing the output of UDSFs. A range is expressed as a minimum/maximum value (inclusive) pair.

Instances of this class are used to allow UDSF developers to specify what the output range of of the function is. The UDSF developer is responsible to override ScalarFunction::getOutputRange() and set the function's output range using the knowledge of the input argument ranges passed as references to ScalarFunction::getOutputRange().

Member Function Documentation

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

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
inline

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

size_t Vertica::VerticaValueRange::getNumRanges ( ) const
inline

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

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
inline

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

void Vertica::VerticaValueRange::setCanHaveNulls ( size_t  idx,
bool  u 
)
inlineprotected

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 
)
inlineprotected

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