This class implements the interval encoding of Chan and Ioannidis. More...
#include <ibin.h>
Public Member Functions | |
virtual long | append (const char *dt, const char *df, uint32_t nnew) |
Create index for the data in df and append the result to the index in dt. | |
long | append (const ibis::mesa &tail) |
virtual void | binBoundaries (std::vector< double > &) const |
The function binBoundaries and binWeights return bin boundaries and counts of each bin respectively. | |
virtual void | binWeights (std::vector< uint32_t > &) const |
virtual void | estimate (const ibis::qContinuousRange &expr, ibis::bitvector &lower, ibis::bitvector &upper) const |
Provide an estimation based on the current index. | |
virtual uint32_t | estimate (const ibis::qContinuousRange &expr) const |
Compute an upper bound on the number of hits. | |
virtual long | evaluate (const ibis::qContinuousRange &expr, ibis::bitvector &hits) const |
To evaluate the exact hits. | |
virtual long | evaluate (const ibis::qDiscreteRange &expr, ibis::bitvector &hits) const |
To evaluate the exact hits. | |
virtual double | getSum () const |
Compute the approximate value of the sum from the binned index. | |
mesa (const ibis::column *c=0, const char *f=0) | |
Constructor. Generate index from the base data. | |
mesa (const ibis::column *c, ibis::fileManager::storage *st, size_t offset=8) | |
Constructor. | |
mesa (const ibis::bin &rhs) | |
Constructor. | |
virtual const char * | name () const |
Returns the name of the index, similar to the function type , but returns a string instead. | |
virtual uint32_t | numBins () const |
virtual void | print (std::ostream &out) const |
Prints human readable information. | |
virtual long | select (const ibis::qContinuousRange &, void *) const |
Select the rows that satisfy the range condition. | |
virtual long | select (const ibis::qContinuousRange &, void *, ibis::bitvector &) const |
Select the rows that satisfy the range condition. | |
virtual void | speedTest (std::ostream &out) const |
Time some logical operations and print out their speed. | |
virtual INDEX_TYPE | type () const |
Returns an index type identifier. | |
virtual float | undecidable (const ibis::qContinuousRange &expr, ibis::bitvector &iffy) const |
Mark the position of the rows that can not be decided with this index. | |
virtual int | write (const char *dt) const |
Write the content of the index the specified location. | |
Protected Member Functions | |
virtual double | computeSum () const |
Compute the sum of values from the information in the index. | |
void | construct (const char *) |
Construct a new index. | |
virtual size_t | getSerialSize () const throw () |
Estimate the size of serialized version of the index. |
This class implements the interval encoding of Chan and Ioannidis.
ibis::mesa::mesa | ( | const ibis::column * | c, |
ibis::fileManager::storage * | st, | ||
size_t | start = 8 |
||
) |
Constructor.
Reconstruct an index from a storage object. The layout of data members are the same as ibis::bin. The difference is that the last half of the bit vectors are always empty.
References ibis::index::col, ibis::gVerbose, ibis::part::name(), ibis::column::name(), ibis::bin::nobs, ibis::index::nrows, and print().
ibis::mesa::mesa | ( | const ibis::bin & | rhs | ) | [explicit] |
Constructor.
Construct an interval encoded index from an equality encoded index.
References ibis::index::bits, ibis::bin::bounds, ibis::util::clear(), ibis::index::col, ibis::bitvector::copy(), ibis::gVerbose, ibis::bin::maxval, ibis::bin::minval, ibis::bin::nobs, and ibis::index::nrows.
void ibis::mesa::binBoundaries | ( | std::vector< double > & | ) | const [virtual] |
The function binBoundaries and binWeights return bin boundaries and counts of each bin respectively.
Reimplemented from ibis::bin.
double ibis::mesa::computeSum | ( | ) | const [protected, virtual] |
Compute the sum of values from the information in the index.
Compute the approximate sum of all values using the binned index.
Reimplemented from ibis::bin.
References ibis::bitvector::cnt().
void ibis::mesa::construct | ( | const char * | df | ) | [protected] |
Construct a new index.
Constructor an new index from data file in the specified location.
This function first construct equality bins then convert to the interval encoding.
Reimplemented from ibis::bin.
References ibis::util::clear(), ibis::bin::construct(), ibis::gVerbose, and ibis::array_t< T >::resize().
void ibis::mesa::estimate | ( | const ibis::qContinuousRange & | expr, |
ibis::bitvector & | lower, | ||
ibis::bitvector & | upper | ||
) | const [virtual] |
Provide an estimation based on the current index.
Set bits in lower are hits for certain, set bits in upper are candidates. Set bits in (upper - lower) should be checked to verifies which ones are actually hits. If the bitvector upper contain less bits than bitvector lower, the content of upper is assumed to be the same as lower.
Reimplemented from ibis::bin.
References ibis::bitvector::clear(), ibis::bitvector::copy(), ibis::bitvector::set(), and ibis::bitvector::size().
long ibis::mesa::evaluate | ( | const ibis::qContinuousRange & | expr, |
ibis::bitvector & | hits | ||
) | const [virtual] |
To evaluate the exact hits.
On success, return the number of hits, otherwise a negative value is returned.
Reimplemented from ibis::bin.
References ibis::bitvector::cnt(), ibis::bitvector::copy(), ibis::bitvector::set(), and ibis::bitvector::size().
virtual long ibis::mesa::evaluate | ( | const ibis::qDiscreteRange & | , |
ibis::bitvector & | |||
) | const [inline, virtual] |
To evaluate the exact hits.
On success, return the number of hits, otherwise a negative value is returned.
Reimplemented from ibis::bin.
References ibis::range::evaluate().
size_t ibis::mesa::getSerialSize | ( | ) | const throw () [protected, virtual] |
Estimate the size of serialized version of the index.
The estimation assumes the bitmap offsets are stored in 8-byte offsets. The size is measured in bytes.
Reimplemented from ibis::bin.
virtual const char* ibis::mesa::name | ( | ) | const [inline, virtual] |
Returns the name of the index, similar to the function type
, but returns a string instead.
Reimplemented from ibis::bin.
void ibis::mesa::print | ( | std::ostream & | out | ) | const [virtual] |
Prints human readable information.
Outputs information about the index as text to the specified output stream.
Reimplemented from ibis::bin.
References ibis::gVerbose.
Referenced by mesa().
virtual long ibis::mesa::select | ( | const ibis::qContinuousRange & | cmp, |
void * | vals | ||
) | const [inline, virtual] |
Select the rows that satisfy the range condition.
Output the values in vals. The values are in unspecified order to reduce the amount of processing needed in this function -- this follows the spirit of SQL standard.
Reimplemented from ibis::bin.
virtual long ibis::mesa::select | ( | const ibis::qContinuousRange & | cmp, |
void * | vals, | ||
ibis::bitvector & | hits | ||
) | const [inline, virtual] |
Select the rows that satisfy the range condition.
Output the rows in the bit vector hits and the corresponding values in vals.
Reimplemented from ibis::bin.
float ibis::mesa::undecidable | ( | const ibis::qContinuousRange & | , |
ibis::bitvector & | |||
) | const [virtual] |
Mark the position of the rows that can not be decided with this index.
expr | the range conditions to be evaluated. |
iffy | the bitvector marking the positions of rows that can not be decided using the index. Return value is the expected fraction of undecided rows that might satisfy the range conditions. |
Reimplemented from ibis::bin.
References ibis::bitvector::cnt(), ibis::qContinuousRange::leftBound(), ibis::qContinuousRange::rightBound(), ibis::bitvector::set(), and ibis::bitvector::size().
int ibis::mesa::write | ( | const char * | dt | ) | const [virtual] |
Write the content of the index the specified location.
The argument dt can be either a directory name or a file name. The actual file name to use for exporting the index is determined by the function indexFileName. The layout of the member variables is the same as with ibis::bin.
Reimplemented from ibis::bin.
References ibis::fileManager::flushFile(), ibis::gVerbose, ibis::fileManager::instance(), ibis::index::MESA, UnixOpen, ibis::bin::write32(), and ibis::bin::write64().
![]() |