The equality encoded bitmap index with binning. More...
#include <ibin.h>
Classes | |
struct | granule |
A data structure to assist the mapping of values to lower precisions. More... | |
Public Types | |
typedef std::map< double, granule * > | granuleMap |
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::bin &tail) |
Append the tail to this index. | |
long | append (const array_t< uint32_t > &ind) |
Append a list of integers representing bin numbers. | |
bin (const ibis::column *c, ibis::fileManager::storage *st, size_t offset=8) | |
bin (const ibis::bin &rhs) | |
Copy constructor. It performs a deep copy. | |
bin (const ibis::column *c, const char *f, const array_t< double > &bd) | |
Constructor. Construct an index with the given bin boundaries. | |
bin (const ibis::column *c=0, const char *f=0) | |
Constructor. Construct a bitmap index from current data. | |
bin (const ibis::column *c, const char *f, const std::vector< double > &bd) | |
Constructor. Construct an index with the given bin boundaries. | |
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 |
long | checkBin (const ibis::qRange &cmp, uint32_t jbin, const ibis::bitvector &mask, ibis::bitvector &res) const |
Candidate check using the binned values. | |
long | checkBin (const ibis::qRange &cmp, uint32_t jbin, ibis::bitvector &res) const |
Candidate check using the binned values. | |
virtual int | contractRange (ibis::qContinuousRange &rng) const |
virtual void | estimate (const ibis::deprecatedJoin &expr, ibis::bitvector64 &lower, ibis::bitvector64 &upper) const |
Estimate the hits for symmetric joins. | |
virtual void | estimate (const ibis::deprecatedJoin &expr, const ibis::bitvector &mask, ibis::bitvector64 &lower, ibis::bitvector64 &upper) const |
virtual void | estimate (const ibis::deprecatedJoin &expr, const ibis::bitvector &mask, const ibis::qRange *const range1, const ibis::qRange *const range2, ibis::bitvector64 &lower, ibis::bitvector64 &upper) const |
Evaluating a join condition with one (likely composite) index. | |
virtual void | estimate (const ibis::bin &idx2, const ibis::deprecatedJoin &expr, const ibis::bitvector &mask, ibis::bitvector64 &lower, ibis::bitvector64 &upper) const |
virtual int64_t | estimate (const ibis::deprecatedJoin &expr, const ibis::bitvector &mask, const ibis::qRange *const range1, const ibis::qRange *const range2) const |
virtual void | estimate (const ibis::bin &idx2, const ibis::deprecatedJoin &expr, ibis::bitvector64 &lower, ibis::bitvector64 &upper) const |
Estimate the number of hits for nonsymmetric joins. | |
virtual void | estimate (const ibis::bin &idx2, const ibis::deprecatedJoin &expr, const ibis::bitvector &mask, const ibis::qRange *const range1, const ibis::qRange *const range2, ibis::bitvector64 &lower, ibis::bitvector64 &upper) const |
virtual int64_t | estimate (const ibis::bin &idx2, const ibis::deprecatedJoin &expr) const |
virtual int64_t | estimate (const ibis::bin &idx2, const ibis::deprecatedJoin &expr, const ibis::bitvector &mask) const |
virtual int64_t | estimate (const ibis::bin &idx2, const ibis::deprecatedJoin &expr, const ibis::bitvector &mask, const ibis::qRange *const range1, const ibis::qRange *const range2) const |
virtual uint32_t | estimate (const ibis::qContinuousRange &expr) const |
Compute an upper bound on the number of hits. | |
virtual void | estimate (const ibis::qContinuousRange &expr, ibis::bitvector &lower, ibis::bitvector &upper) const |
Provide an estimation based on the current index. | |
virtual double | estimateCost (const ibis::qContinuousRange &expr) const |
Estimate the code of evaluate a range condition. | |
virtual double | estimateCost (const ibis::qDiscreteRange &expr) const |
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 int | expandRange (ibis::qContinuousRange &rng) const |
The functions expandRange and contractRange expands or contracts the boundaries of a range condition so that the new range will have exact answers using the function estimate. | |
virtual long | getCumulativeDistribution (std::vector< double > &bds, std::vector< uint32_t > &cts) const |
Compute the cumulative distribution from the binned index. | |
virtual long | getDistribution (std::vector< double > &bbs, std::vector< uint32_t > &cts) const |
Compute a histogram from the binned index. | |
virtual double | getMax () const |
Compute the actual maximum value from the binned index. | |
virtual double | getMin () const |
Compute the actual minimum value from the binned index. | |
virtual double | getSum () const |
Compute the approximate value of the sum from the binned index. | |
array_t< uint32_t > * | indices (const ibis::bitvector &mask) const |
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 int | read (const char *idxfile) |
Read from a file named f. | |
virtual int | read (ibis::fileManager::storage *st) |
Read from a reference counted piece of memory. | |
int | read (int fdes, size_t offset, const char *fname, const char *header) |
Read an ibis::bin embedded inside a file. | |
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 index to the named directory or file. | |
Protected Member Functions | |
void | addBounds (double lbd, double rbd, uint32_t nbins, uint32_t eqw) |
The function used by setBoudaries() to actually generate the bounds. | |
virtual void | adjustLength (uint32_t nrows) |
Fill the bitmaps to the specified size. | |
bin (const ibis::column *c, const uint32_t nbits, ibis::fileManager::storage *st, size_t offset=8) | |
A constructor to accommodate multicomponent encodings. | |
void | binning (const char *f, const array_t< double > &bd) |
template<typename E > | |
void | binning (const array_t< E > &varr, const array_t< double > &bd) |
void | binning (const char *f) |
Read the data file and partition the values into bins according to the specified bin boundary. | |
void | binning (const char *f, const std::vector< double > &bd) |
Generate bins according to the specified boundaries. | |
template<typename E > | |
void | binning (const array_t< E > &varr) |
template<typename E > | |
void | binningT (const char *fname) |
Read the data file, partition the values, and write out the bin ordered data with .bin suffix. | |
long | binOrder (const char *fname) const |
template<typename E > | |
long | binOrderT (const char *fname) const |
Write bin-ordered values. | |
template<typename E > | |
long | checkBin0 (const ibis::qRange &cmp, uint32_t jbin, ibis::bitvector &res) const |
template<typename E > | |
long | checkBin1 (const ibis::qRange &cmp, uint32_t jbin, const ibis::bitvector &mask, ibis::bitvector &res) const |
virtual void | clear () |
Clear the existing content. | |
virtual double | computeSum () const |
Compute the sum of values from the information in the index. | |
void | construct (const char *) |
Construct a binned bitmap index. | |
template<typename E > | |
void | construct (const array_t< E > &varr) |
void | convertGranules (granuleMap &gmap) |
Convert the granule map into binned index. | |
void | divideBitmaps (const std::vector< ibis::bitvector * > &bms, std::vector< unsigned > &parts) const |
Partition the bitmaps into groups of takes about the same amount of storage. | |
virtual size_t | getSerialSize () const throw () |
Estimate the size of the serialized version of the index. | |
virtual uint32_t | locate (const double &val) const |
Find the bin containing val. | |
virtual void | locate (const ibis::qContinuousRange &expr, uint32_t &cand0, uint32_t &cand1, uint32_t &hit0, uint32_t &hit1) const |
Find the bins related to the range expression. | |
virtual void | locate (const ibis::qContinuousRange &expr, uint32_t &cand0, uint32_t &cand1) const |
Find the outer boundaries of the range expression. | |
template<typename E > | |
void | mapGranules (const array_t< E > &, granuleMap &gmap) const |
uint32_t | parseNbins () const |
Parse the index specs to determine eqw and nbins. | |
unsigned | parsePrec () const |
Parse the index spec to extract precision. | |
unsigned | parseScale () const |
Parse the specification about scaling. | |
void | printGranules (std::ostream &out, const granuleMap &gmap) const |
void | readBinBoundaries (const char *name, uint32_t nb) |
Read a file containing a list of floating-point numbers. | |
template<typename E > | |
void | scanAndPartition (const array_t< E > &, unsigned) |
void | scanAndPartition (const char *, unsigned, uint32_t nbins=0) |
Partition the range based on the (approximate) histogram of the data. | |
void | setBoundaries (const char *f) |
Set bin boundaries. | |
void | setBoundaries (array_t< double > &bnds, const ibis::bin &idx1, const array_t< uint32_t > cnt1, const array_t< uint32_t > cnt0) const |
void | setBoundaries (array_t< double > &bnds, const ibis::bin &bin0) const |
template<typename E > | |
void | setBoundaries (const array_t< E > &varr) |
void | swap (bin &rhs) |
Swap the content of the index. | |
int | write32 (int fptr) const |
Write the content to a file already open. | |
int | write64 (int fptr) const |
write the content to a file already open. | |
Protected Attributes | |
array_t< double > | bounds |
The nominal boundaries. | |
array_t< double > | maxval |
The maximal values in each bin. | |
array_t< double > | minval |
The minimal values in each bin. | |
uint32_t | nobs |
Number of bitvectors. | |
Friends | |
class | ibis::ambit |
class | ibis::band |
class | ibis::mesa |
class | ibis::mesh |
class | ibis::pack |
class | ibis::pale |
class | ibis::range |
class | ibis::zone |
The equality encoded bitmap index with binning.
The exact bin boundary assignment is controlled by indexing options '<binning ... />'.
The 0th bit vector represents x < bounds[0]; The (nobs-1)st bit vector represents x >= bounds[nobs-2]; The ith bit vector represents bounds[i-1] <= x < bounds[i], (0 < i < nbos-1).
ibis::bin::bin | ( | const ibis::column * | c, |
const uint32_t | nbits, | ||
ibis::fileManager::storage * | st, | ||
size_t | start = 8 |
||
) | [protected] |
A constructor to accommodate multicomponent encodings.
Constructor.
Reconstruct from content of fileManager::storage.
The common portion of the index files writen by derived classes of bin 8-byte header nrows(uint32_t) -- number of bits in each bit vector nobs (uint32_t) -- number of bit vectors offsets (intxx_t[nobs+1]) -- the starting positions of the bit sequences (i.e., bit vectors) plus the end position of the last one (padding to ensure the next data element is on 8-byte boundary) bounds (double[nobs]) -- the end positions (right sides) of the bins maxval (double[nobs]) -- the maximum value of all values fall in the bin minval (double[nobs]) -- the minimum value of all those fall in the bin the bit sequences as bit vectors @encdoe */ ibis::bin::bin(const ibis::column* c, ibis::fileManager::storage* st, size_t start) : ibis::index(c, st), nobs(*(reinterpret_cast<uint32_t*>(st->begin()+start+sizeof(uint32_t)))), bounds(st, 8*((start+(*st)[6]*(nobs+1)+2*sizeof(uint32_t)+7)/8), 8*((start+(*st)[6]*(nobs+1)+2*sizeof(uint32_t)+7)/8) + sizeof(double)*nobs), maxval(st, 8*((start+(*st)[6]*(nobs+1)+2*sizeof(uint32_t)+7)/8) + sizeof(double)*nobs, 8*((start+(*st)[6]*(nobs+1)+2*sizeof(uint32_t)+7)/8) + sizeof(double)*nobs*2), minval(st, 8*((start+(*st)[6]*(nobs+1)+2*sizeof(uint32_t)+7)/8) + sizeof(double)*nobs*2, 8*((start+(*st)[6]*(nobs+1)+2*sizeof(uint32_t)+7)/8) + sizeof(double)*nobs*3) { try { nrows = *(reinterpret_cast<uint32_t*>(st->begin()+start)); LOGGER(c->partition()->getState() == ibis::part::STABLE_STATE && nrows != c->partition()->nRows() && ibis::gVerbose > 2) << "Warning -- bin[" << col->partition()->name() << '.' << col->name() << "]::bin found nrows (" << nrows << ") to be different from that of the data partition " << c->partition()->name() << " (" << c->partition()->nRows() << ")"; int ierr = initOffsets(st, start+2*sizeof(uint32_t), nobs); if (ierr < 0) { << "Warning -- bin[" << col->partition()->name() << '.' << col->name() << "]::bin failed to initialize bitmap offsets" << " from storage object @ " << st << " with start = " << start << ", ierr = " << ierr; throw "bin::ctor failed to initOffsets from storage"; } initBitmaps(st); if (ibis::gVerbose > 2) { ibis::util::logger lg; lg()<< "bin[" << col->partition()->name() << '.' << col->name() << "]::ctor -- initialization completed with " << nobs << " bin" << (nobs>1?"s":"") << " for " << nrows << " row" << (nrows>1?"s":"") << " from a storage object @ " << st << " offset " << start; if (ibis::gVerbose > 8) { lg() << "\n"; print(lg()); } } } catch (...) { clear(); throw; } } // ibis::bin::bin
References ibis::fileManager::storage::begin(), ibis::index::col, ibis::gVerbose, ibis::index::initBitmaps(), ibis::index::initOffsets(), ibis::column::name(), ibis::part::name(), nobs, ibis::index::nrows, and print().
void ibis::bin::adjustLength | ( | uint32_t | nr | ) | [protected, 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 in ibis::ambit, ibis::pale, ibis::pack, ibis::zone, and ibis::fuge.
Referenced by ibis::zone::adjustLength(), ibis::pale::adjustLength(), ibis::pack::adjustLength(), ibis::fuge::adjustLength(), and ibis::ambit::adjustLength().
void ibis::bin::binBoundaries | ( | std::vector< double > & | ) | const [virtual] |
The function binBoundaries and binWeights return bin boundaries and counts of each bin respectively.
Reimplemented from ibis::index.
Reimplemented in ibis::range, ibis::mesa, ibis::ambit, ibis::pale, ibis::pack, ibis::zone, ibis::egale, ibis::bak, and ibis::bak2.
void ibis::bin::binning | ( | const char * | f, |
const std::vector< double > & | bd | ||
) | [protected] |
Generate bins according to the specified boundaries.
This version of the binning function takes an external specified bin boundaries -- if the array is too small to be valid, it uses the default option.
References ibis::BYTE, ibis::DOUBLE, ibis::FLOAT, ibis::gVerbose, ibis::INT, ibis::LONG, ibis::SHORT, ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.
Referenced by append(), bin(), and ibis::egale::egale().
void ibis::bin::binning | ( | const char * | f | ) | [protected] |
Read the data file and partition the values into bins according to the specified bin boundary.
References ibis::bitvector::adjustSize(), ibis::bitvector::bitsPerLiteral(), ibis::BYTE, ibis::CATEGORY, ibis::index::clear(), ibis::util::compactValue(), ibis::bitvector::copy(), ibis::DOUBLE, ibis::FLOAT, ibis::fileManager::getFile(), ibis::gVerbose, ibis::fileManager::instance(), ibis::INT, ibis::LONG, ibis::horometer::realTime(), ibis::bitvector::set(), ibis::SHORT, ibis::bitvector::size(), ibis::array_t< T >::size(), ibis::horometer::start(), ibis::horometer::stop(), ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.
void ibis::bin::binningT | ( | const char * | fname | ) | [protected] |
Read the data file, partition the values, and write out the bin ordered data with .bin suffix.
References ibis::bitvector::adjustSize(), ibis::bitvector::bitsPerLiteral(), ibis::index::clear(), ibis::bitvector::copy(), ibis::fileManager::getFile(), ibis::gVerbose, ibis::fileManager::instance(), ibis::array_t< T >::push_back(), ibis::horometer::realTime(), ibis::bitvector::set(), ibis::bitvector::size(), ibis::array_t< T >::size(), ibis::horometer::start(), ibis::horometer::stop(), and UnixOpen.
long ibis::bin::checkBin | ( | const ibis::qRange & | cmp, |
uint32_t | jbin, | ||
ibis::bitvector & | res | ||
) | const |
Candidate check using the binned values.
Returns the number of hits if successful, otherwise it returns a negative value.
References ibis::BYTE, ibis::bitvector::clear(), ibis::horometer::CPUTime(), ibis::DOUBLE, ibis::FLOAT, ibis::gVerbose, ibis::INT, ibis::LONG, ibis::horometer::realTime(), ibis::SHORT, ibis::horometer::start(), ibis::horometer::stop(), ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.
long ibis::bin::checkBin | ( | const ibis::qRange & | cmp, |
uint32_t | jbin, | ||
const ibis::bitvector & | mask, | ||
ibis::bitvector & | res | ||
) | const |
Candidate check using the binned values.
The bitvector mask
marks the actual values in the bin (because the bitmaps stored in bits
do not directly corresponds to the bin).
References ibis::BYTE, ibis::bitvector::clear(), ibis::bitvector::cnt(), ibis::horometer::CPUTime(), ibis::DOUBLE, ibis::FLOAT, ibis::gVerbose, ibis::INT, ibis::LONG, ibis::horometer::realTime(), ibis::SHORT, ibis::bitvector::size(), ibis::horometer::start(), ibis::horometer::stop(), ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.
void ibis::bin::clear | ( | ) | [protected, virtual] |
Clear the existing content.
Free the objectes pointed to by the pointers.
Reimplemented from ibis::index.
Reimplemented in ibis::ambit, ibis::pale, ibis::pack, ibis::zone, ibis::fuge, and ibis::egale.
References ibis::index::clear().
Referenced by append(), bin(), ibis::zone::clear(), ibis::pale::clear(), ibis::pack::clear(), ibis::ambit::clear(), ibis::egale::clear(), ibis::fuge::clear(), ibis::mesa::mesa(), and ibis::range::range().
double ibis::bin::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 in ibis::range, ibis::mesa, ibis::ambit, ibis::pack, ibis::egale, ibis::moins, and ibis::entre.
void ibis::bin::construct | ( | const char * | df | ) | [protected] |
Construct a binned bitmap index.
This construction function is designed to handle the full spectrum of binning specifications.
It invokes ibis::bak2 to handle reduced precision binning.
Reimplemented in ibis::range, ibis::mesa, and ibis::egale.
References ibis::BYTE, ibis::DOUBLE, ibis::FLOAT, ibis::fileManager::getFile(), ibis::gParameters(), ibis::gVerbose, ibis::fileManager::instance(), ibis::INT, ibis::LONG, ibis::util::reorder(), ibis::bitvector::set(), ibis::SHORT, ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.
Referenced by bin(), ibis::range::construct(), and ibis::mesa::construct().
void ibis::bin::convertGranules | ( | granuleMap & | gmap | ) | [protected] |
Convert the granule map into binned index.
The bitmaps that are not empty are transferred to the array bits, therefore, the content of gmap is no longer valid after calling this function. However, it is still necessary for the called to free gmap.
References ibis::util::compactValue(), and ibis::gVerbose.
void ibis::bin::divideBitmaps | ( | const std::vector< ibis::bitvector * > & | bms, |
std::vector< unsigned > & | parts | ||
) | const [protected] |
Partition the bitmaps into groups of takes about the same amount of storage.
References ibis::gVerbose.
Referenced by ibis::pack::pack(), and ibis::zone::zone().
void ibis::bin::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::index.
Reimplemented in ibis::range, ibis::mesa, ibis::ambit, ibis::pale, ibis::pack, ibis::zone, ibis::fuge, ibis::egale, ibis::moins, and ibis::entre.
References ibis::bitvector::clear(), ibis::bitvector::copy(), ibis::gVerbose, and ibis::bitvector::set().
void ibis::bin::estimate | ( | const ibis::deprecatedJoin & | expr, |
ibis::bitvector64 & | lower, | ||
ibis::bitvector64 & | upper | ||
) | const [virtual] |
Estimate the hits for symmetric joins.
Evaluate the range join condition using the ibis::bin index.
Record the definite hits in lower
, and all possible hits in upper
. NOTE: upper
includes all entries in lower
.
References ibis::bitvector64::clear(), ibis::bitvector64::cnt(), ibis::horometer::CPUTime(), ibis::math::term::eval(), ibis::gVerbose, ibis::horometer::realTime(), ibis::bitvector64::set(), ibis::bitvector64::size(), ibis::horometer::start(), and ibis::horometer::stop().
long ibis::bin::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.
Implements ibis::index.
Reimplemented in ibis::range, ibis::mesa, ibis::ambit, ibis::pale, ibis::pack, ibis::zone, ibis::fuge, ibis::egale, ibis::moins, and ibis::entre.
References ibis::bitvector::cnt(), ibis::bitvector::copy(), ibis::gVerbose, ibis::bitvector::set(), and ibis::bitvector::size().
Referenced by evaluate().
virtual long ibis::bin::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::index.
Reimplemented in ibis::range, ibis::mesa, ibis::ambit, ibis::pale, ibis::pack, ibis::zone, ibis::fuge, ibis::egale, ibis::moins, and ibis::entre.
References evaluate().
int ibis::bin::expandRange | ( | ibis::qContinuousRange & | ) | const [virtual] |
The functions expandRange and contractRange expands or contracts the boundaries of a range condition so that the new range will have exact answers using the function estimate.
The default implementation provided does nothing since this is only meaningful for indices based on bins.
Reimplemented from ibis::index.
Reimplemented in ibis::range, ibis::bak, and ibis::bak2.
References ibis::util::compactValue(), ibis::qContinuousRange::leftBound(), and ibis::qContinuousRange::rightBound().
size_t ibis::bin::getSerialSize | ( | ) | const throw () [protected, virtual] |
Estimate the size of the serialized version of the index.
Return the size in bytes.
Reimplemented in ibis::range, ibis::mesa, ibis::ambit, ibis::pale, ibis::pack, ibis::zone, ibis::fuge, and ibis::egale.
uint32_t ibis::bin::locate | ( | const double & | val | ) | const [protected, virtual] |
Find the bin containing val.
Find the smallest i such that bounds[i] > val.
Reimplemented in ibis::range, ibis::bak, and ibis::bak2.
References ibis::gVerbose.
Referenced by ibis::bak2::expandRange(), and ibis::bak::expandRange().
void ibis::bin::locate | ( | const ibis::qContinuousRange & | expr, |
uint32_t & | cand0, | ||
uint32_t & | cand1 | ||
) | const [protected, virtual] |
Find the outer boundaries of the range expression.
Locate the outer reaches of a continuous range expression.
Reimplemented in ibis::range, ibis::bak, and ibis::bak2.
References ibis::gVerbose, ibis::qContinuousRange::leftBound(), and ibis::qContinuousRange::rightBound().
void ibis::bin::locate | ( | const ibis::qContinuousRange & | expr, |
uint32_t & | cand0, | ||
uint32_t & | cand1, | ||
uint32_t & | hit0, | ||
uint32_t & | hit1 | ||
) | const [protected, virtual] |
Find the bins related to the range expression.
Locate the bins for all candidates and hits.
Reimplemented in ibis::range, ibis::bak, and ibis::bak2.
References ibis::gVerbose, ibis::qContinuousRange::leftBound(), and ibis::qContinuousRange::rightBound().
virtual const char* ibis::bin::name | ( | ) | const [inline, virtual] |
Returns the name of the index, similar to the function type
, but returns a string instead.
Implements ibis::index.
Reimplemented in ibis::range, ibis::mesa, ibis::ambit, ibis::pale, ibis::pack, ibis::zone, ibis::fuge, ibis::egale, ibis::moins, ibis::entre, ibis::bak, and ibis::bak2.
void ibis::bin::print | ( | std::ostream & | out | ) | const [virtual] |
Prints human readable information.
Outputs information about the index as text to the specified output stream.
Implements ibis::index.
Reimplemented in ibis::range, ibis::mesa, ibis::ambit, ibis::pale, ibis::pack, ibis::zone, ibis::fuge, ibis::egale, ibis::moins, ibis::entre, ibis::bak, and ibis::bak2.
References ibis::gVerbose.
Referenced by bin().
int ibis::bin::read | ( | int | fdes, |
size_t | start, | ||
const char * | fn, | ||
const char * | header | ||
) |
Read an ibis::bin embedded inside a file.
Read from a file starting from an arbitrary start
position.
This is intended to be used by multi-level indices. The size of bitmap offsets are defined in header[6] and full index type is defined in header[5].
Reimplemented in ibis::range.
References ibis::gVerbose, ibis::fileManager::instance(), ibis::fileManager::recordPages(), and ibis::util::strnewdup().
void ibis::bin::scanAndPartition | ( | const char * | f, |
unsigned | eqw, | ||
uint32_t | nbins = 0 |
||
) | [protected] |
Partition the range based on the (approximate) histogram of the data.
The optional argument nbins
can either be set outside or set to be the return value of function parseNbins.
References ibis::array_t< T >::clear(), ibis::util::compactValue(), ibis::DOUBLE, ibis::FLOAT, ibis::util::incrDouble(), ibis::array_t< T >::push_back(), ibis::array_t< T >::reserve(), and ibis::array_t< T >::size().
void ibis::bin::setBoundaries | ( | const char * | f | ) | [protected] |
Set bin boundaries.
Parse the index specification to determine the bin boundaries and store the result in member variable bounds.
The bin specification can be of the following, where all fields are optional.
equal([_-]?)[weight|length|ratio])
no=xx|nbins=xx|bins:(\[begin, end, no=xx\))+
<binning (start=begin end=end nbins=xx scale=[linear|log])* />
The bin speficication can be read from the column object, the table object containing the column, or the global ibis::gParameters object under the name of table-name.column-name.index
. If no index specification is found, it builts approximate equal weight bins.
References ibis::util::compactValue(), ibis::DOUBLE, ibis::FLOAT, ibis::gVerbose, and ibis::util::readString().
Referenced by ibis::egale::egale().
float ibis::bin::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::index.
Reimplemented in ibis::range, ibis::mesa, ibis::ambit, ibis::pale, ibis::pack, ibis::zone, and ibis::egale.
References ibis::bitvector::copy(), ibis::qContinuousRange::leftBound(), ibis::qContinuousRange::rightBound(), and ibis::bitvector::set().
![]() |