A two-level index. More...
#include <ibin.h>
Public Member Functions | |
virtual void | adjustLength (uint32_t nrows) |
Fill the bitmaps to the specified size. | |
long | append (const ibis::fuge &tail) |
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. | |
virtual void | estimate (const ibis::qContinuousRange &expr, ibis::bitvector &lower, ibis::bitvector &upper) const |
Provide an estimation based on the current index. | |
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. | |
fuge (const ibis::bin &rhs) | |
fuge (const ibis::column *c, ibis::fileManager::storage *st, size_t offset=8) | |
Reconstruct from content of a file. | |
fuge (const ibis::column *, const char *) | |
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 |
Prints human readable information. | |
virtual int | read (ibis::fileManager::storage *st) |
Read an index from the storage object. | |
virtual int | read (const char *idxfile) |
Read the content of the named file. | |
virtual INDEX_TYPE | type () const |
Returns an index type identifier. | |
virtual int | write (const char *dt) const |
Write the index to the named directory or file. | |
Protected Member Functions | |
virtual void | clear () |
Clear the existing content. | |
virtual size_t | getSerialSize () const throw () |
Estimate the size of the serialized version of the index. |
A two-level index.
The top (coarse) level uses the interval encoding and the bottom (fine) level uses the equality encoding. Similar to class ibis::fuzz, the fine level bitmaps are kept together as in ibis::bin and the coarse level bitmaps are placed at the end of the index file.
ibis::fuge::fuge | ( | const ibis::column * | c, |
ibis::fileManager::storage * | st, | ||
size_t | start = 8 |
||
) |
Reconstruct from content of a file.
The leading portion of the index file is the same as ibis::bin, which allows the constructor of the base class to work properly. The content following the last bitvector in ibis::bin is as follows,
nc (uint32_t) -- number of coarse bins.
cbounds (unsigned[nc+1]) -- boundaries of the coarse bins.
coffsets([nc-ceil(nc/2)+2]) -- starting positions (32/64-bit).
cbits (bitvector[nc-ceil(nc/2)+1]) -- bitvectors.
References ibis::fileManager::storage::begin(), ibis::array_t< T >::clear(), clear(), ibis::index::col, ibis::gVerbose, ibis::fileManager::storage::isFileMap(), ibis::column::name(), ibis::part::name(), ibis::bin::nobs, ibis::index::nrows, ibis::index::offset32, ibis::index::offset64, print(), ibis::fileManager::storage::size(), and ibis::array_t< T >::swap().
void ibis::fuge::adjustLength | ( | uint32_t | nr | ) | [virtual] |
Fill the bitmaps to the specified size.
Fill the bitvectors with zeros so that they all contain nrows bits.
Truncate the bitvectors if they have more bits.
Reimplemented from ibis::bin.
References ibis::bin::adjustLength().
virtual void ibis::fuge::clear | ( | ) | [inline, protected, virtual] |
Clear the existing content.
Free the objectes pointed to by the pointers.
Reimplemented from ibis::bin.
References ibis::bin::clear().
Referenced by fuge().
void ibis::fuge::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::gVerbose, and ibis::bitvector::set().
long ibis::fuge::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(), and ibis::bitvector::size().
virtual long ibis::fuge::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::fuge::getSerialSize | ( | ) | const throw () [protected, virtual] |
Estimate the size of the serialized version of the index.
Return the size in bytes.
Reimplemented from ibis::bin.
References ibis::bitvector::size().
virtual const char* ibis::fuge::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::fuge::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 fuge().
![]() |