Public Member Functions | Protected Member Functions | Protected Attributes | Friends
ibis::range Class Reference

The range encoded bitmap index based. More...

#include <ibin.h>

Inheritance diagram for ibis::range:
ibis::bin ibis::index

List of all members.

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::range &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 int contractRange (ibis::qContinuousRange &range) 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 int expandRange (ibis::qContinuousRange &range) 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 double getMax () const
 Compute the actual maximum value from the binned index.
virtual double getSum () const
 Compute the approximate value of the sum from the binned index.
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.
 range (const ibis::column *c=0, const char *f=0)
 range (const ibis::bin &rhs)
 Copy an ibis::bin into an ibis::range.
 range (const ibis::column *c, ibis::fileManager::storage *st, size_t offset=8)
 Reconstruct an index from a storage object.
virtual int read (ibis::fileManager::storage *st)
 Extract the index from a storage object.
virtual int read (const char *idxfile)
 Read the content the named file.
int read (int fdes, size_t offset, const char *fname, const char *)
 Read from a file starting at an arbitrary position.
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 existing content to the given directory or file.

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.
void construct (const char *f, const array_t< double > &bd)
 Construct a new index with the specified bin boundaries.
virtual size_t getSerialSize () const throw ()
 Estimate the size of serialized version of the index.
virtual void locate (const ibis::qContinuousRange &expr, uint32_t &cand0, uint32_t &cand1) const
 Find the outer boundaries of the range expression.
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 uint32_t locate (const double &val) const
 Find the bin containing val.

Protected Attributes

double max1
double min1

Friends

class ibis::pale

Detailed Description

The range encoded bitmap index based.

It can be thought of as a cumulative version of ibis::bin, where the ith bit vector marks the possibles of all entries where x < bounds[i].


Constructor & Destructor Documentation

ibis::range::range ( const ibis::column c,
ibis::fileManager::storage st,
size_t  start = 8 
)

Reconstruct an index from a storage object.

The layout of the content in the storage object is the same as for ibis::bin but there is a difference in semantics. The largest bounds value (bounds[nobs-1]) in this case is not DBL_MAX, those values above bounds[nobs-1] are not explicitly recorded in a bit vector. Instead it is assumed that the compliment of bits[nobs-1] represent the bin.

References ibis::fileManager::storage::begin(), ibis::index::col, ibis::gVerbose, ibis::column::name(), ibis::part::name(), ibis::index::nrows, print(), and ibis::index::RANGE.


Member Function Documentation

void ibis::range::binBoundaries ( std::vector< double > &  ) const [virtual]

The function binBoundaries and binWeights return bin boundaries and counts of each bin respectively.

Reimplemented from ibis::bin.

References ibis::util::compactValue().

double ibis::range::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::range::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.

Note:
This function will not do anything if the estimated cost is high.

Reimplemented from ibis::bin.

References ibis::bitvector::clear(), ibis::bitvector::copy(), ibis::bitvector::flip(), and ibis::bitvector::set().

virtual long ibis::range::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 evaluate().

long ibis::range::evaluate ( const ibis::qContinuousRange expr,
ibis::bitvector hits 
) const [virtual]
int ibis::range::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::bin.

References ibis::util::compactValue(), ibis::qContinuousRange::leftBound(), and ibis::qContinuousRange::rightBound().

size_t ibis::range::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 uint32_t ibis::range::locate ( const double &  val) const [inline, protected, virtual]

Find the bin containing val.

Find the smallest i such that bounds[i] > val.

Reimplemented from ibis::bin.

Referenced by ibis::bak2::locate(), and ibis::bak::locate().

void ibis::range::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 from ibis::bin.

References ibis::gVerbose, ibis::qContinuousRange::leftBound(), and ibis::qContinuousRange::rightBound().

void ibis::range::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 from ibis::bin.

References ibis::gVerbose, ibis::qContinuousRange::leftBound(), and ibis::qContinuousRange::rightBound().

virtual const char* ibis::range::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::range::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 range().

int ibis::range::read ( const char *  f) [virtual]

Read the content the named file.

Replace the existing conent of the index is the file is opened successfully.

Reimplemented from ibis::bin.

References ibis::gVerbose, ibis::fileManager::instance(), ibis::fileManager::recordPages(), ibis::util::strnewdup(), and UnixOpen.

int ibis::range::read ( int  fdes,
size_t  start,
const char *  fn,
const char *  header 
)

Read from a file starting at an arbitrary position.

This function is used for multi-level indexes.

Reimplemented from ibis::bin.

References ibis::gVerbose, ibis::fileManager::instance(), ibis::fileManager::recordPages(), and ibis::util::strnewdup().

float ibis::range::undecidable ( const ibis::qContinuousRange ,
ibis::bitvector  
) const [virtual]

Mark the position of the rows that can not be decided with this index.

Parameters:
exprthe range conditions to be evaluated.
iffythe 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::range::write ( const char *  dt) const [virtual]

Write the existing content to the given directory or file.

The exact file name is determined with the function indexFileName.

Reimplemented from ibis::bin.

References ibis::fileManager::flushFile(), ibis::gVerbose, ibis::fileManager::instance(), ibis::index::RANGE, and UnixOpen.


The documentation for this class was generated from the following files:

Make It A Bit Faster
Contact us
Disclaimers
FastBit source code
FastBit mailing list archive