The bit-sliced index (O'Neil). It used the binary encoding. More...
#include <irelic.h>
Public Member Functions | |
virtual long | append (const char *dt, const char *df, uint32_t nnew) |
Create an index based on data in df and append the result to the index in dt. | |
virtual void | binWeights (std::vector< uint32_t > &b) const |
Return the exact count for each distinct value. | |
virtual void | estimate (const ibis::qContinuousRange &expr, ibis::bitvector &lower, ibis::bitvector &upper) const |
Computes an approximation of hits as a pair of lower and upper bounds. | |
virtual uint32_t | estimate (const ibis::qContinuousRange &expr) const |
Return the number of hits satisfying the given continuous range expression. | |
virtual double | estimateCost (const ibis::qContinuousRange &) const |
Estimate the cost of resolving the continuous range expression. | |
virtual double | estimateCost (const ibis::qDiscreteRange &expr) const |
Estimate the cost of resolving the discrete range expression. | |
virtual long | evaluate (const ibis::qContinuousRange &expr, ibis::bitvector &hits) const |
Compute the hits as a bitvector . | |
virtual long | evaluate (const ibis::qDiscreteRange &expr, ibis::bitvector &hits) const |
Resolve a discrete range condition. | |
virtual double | getSum () const |
Compute the sum of all values of the column indexed. | |
virtual const char * | name () const |
Returns the name of the index, similar to the function type , but returns a string instead. | |
virtual void | print (std::ostream &out) const |
The printing function. | |
virtual int | read (ibis::fileManager::storage *st) |
Reconstruct an index from a piece of consecutive memory. | |
virtual int | read (const char *idxfile) |
Read the index contained in the file f. | |
slice (const ibis::column *c=0, const char *f=0) | |
slice (const ibis::column *c, ibis::fileManager::storage *st, size_t start=8) | |
Reconstruct from content of a storage object. | |
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 int | write (const char *dt) const |
Write the content of the index to the specified location. | |
Protected Member Functions | |
virtual void | clear () |
Free the memory hold by this object. | |
virtual size_t | getSerialSize () const throw () |
Estimate the size of the index in a file. |
The bit-sliced index (O'Neil). It used the binary encoding.
ibis::slice::slice | ( | const ibis::column * | c, |
ibis::fileManager::storage * | st, | ||
size_t | start = 8 |
||
) |
Reconstruct from content of a storage object.
The content of the file (following the 8-byte header) is
nrows(uint32_t) -- the number of bits in each bit sequence nobs (uint32_t) -- the number of bit sequences card (uint32_t) -- the number of distinct values, i.e., cardinality (padding to ensure the next data element is on 8-byte boundary) values (double[card]) -- the distinct values as doubles offset ([nobs+1]) -- the starting positions of the bit sequences (as bit vectors) cnts (uint32_t[card]) -- the counts for each distinct value bitvectors -- the bitvectors one after another
References ibis::index::activate(), ibis::index::bits, clear(), ibis::index::col, ibis::gVerbose, ibis::column::name(), ibis::part::name(), ibis::index::nrows, print(), and ibis::array_t< T >::size().
long ibis::slice::append | ( | const char * | dt, |
const char * | df, | ||
uint32_t | nnew | ||
) | [virtual] |
Create an index based on data in df and append the result to the index in dt.
Reimplemented from ibis::relic.
void ibis::slice::estimate | ( | const ibis::qContinuousRange & | , |
ibis::bitvector & | lower, | ||
ibis::bitvector & | upper | ||
) | const [virtual] |
Computes an approximation of hits as a pair of lower and upper bounds.
expr | the query expression to be evaluated. |
lower | a bitvector marking a subset of the hits. All rows marked with one (1) are definitely hits. |
upper | a bitvector marking a superset of the hits. All hits are marked with one, but some of the rows marked one may not be hits. If the variable upper is empty, the variable lower is assumed to contain the exact answer. |
Reimplemented from ibis::relic.
References ibis::bitvector::clear(), ibis::bitvector::flip(), and ibis::bitvector::set().
uint32_t ibis::slice::estimate | ( | const ibis::qContinuousRange & | expr | ) | const [virtual] |
Return the number of hits satisfying the given continuous range expression.
Reimplemented from ibis::relic.
virtual double ibis::slice::estimateCost | ( | const ibis::qDiscreteRange & | expr | ) | const [inline, virtual] |
Estimate the cost of resolving the discrete range expression.
The answer is in the number of bytes needed from this index.
Reimplemented from ibis::relic.
References ibis::index::bits, ibis::index::offset32, ibis::index::offset64, and ibis::array_t< T >::size().
virtual double ibis::slice::estimateCost | ( | const ibis::qContinuousRange & | expr | ) | const [inline, virtual] |
Estimate the cost of resolving the continuous range expression.
The answer is in the number of bytes needed from this index.
Reimplemented from ibis::relic.
References ibis::index::bits, ibis::index::offset32, ibis::index::offset64, and ibis::array_t< T >::size().
long ibis::slice::evaluate | ( | const ibis::qDiscreteRange & | expr, |
ibis::bitvector & | answer | ||
) | const [virtual] |
Resolve a discrete range condition.
The answer is a bitvector marking the rows satisfying the range conditions.
Reimplemented from ibis::relic.
References ibis::bitvector::cnt(), ibis::qDiscreteRange::getValues(), ibis::bitvector::set(), ibis::bitvector::size(), and ibis::array_t< T >::size().
virtual const char* ibis::slice::name | ( | ) | const [inline, virtual] |
Returns the name of the index, similar to the function type
, but returns a string instead.
Reimplemented from ibis::relic.
int ibis::slice::read | ( | const char * | f | ) | [virtual] |
Read the index contained in the file f.
This function always reads all bitvectors.
Reimplemented from ibis::relic.
References ibis::gVerbose, ibis::fileManager::instance(), ibis::fileManager::recordPages(), ibis::index::SLICE, ibis::array_t< T >::swap(), and UnixOpen.
int ibis::slice::read | ( | ibis::fileManager::storage * | st | ) | [virtual] |
Reconstruct an index from a piece of consecutive memory.
Unlike the implementations for other type indices, this function always reads all bit vectors.
Reimplemented from ibis::relic.
References ibis::fileManager::storage::begin().
int ibis::slice::write | ( | const char * | dt | ) | const [virtual] |
Write the content of the index to the specified location.
The actual index file name is determined by the function indexFileName.
Reimplemented from ibis::relic.
References ibis::fileManager::flushFile(), ibis::gVerbose, ibis::fileManager::instance(), ibis::index::SLICE, and UnixOpen.
![]() |