Public Member Functions | Protected Member Functions
ibis::ambit Class Reference

The multi-level range based (cumulative) index. More...

#include <ibin.h>

Inheritance diagram for ibis::ambit:
ibis::bin ibis::index

List of all members.

Public Member Functions

virtual void adjustLength (uint32_t nrows)
 Fill the bitmaps to the specified size.
 ambit (const ibis::column *c=0, const char *f=0)
 ambit (const ibis::bin &rhs)
 ambit (const ibis::column *c, ibis::fileManager::storage *st, size_t offset=8)
 Reconstruct ambit from content of a storage object.
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::ambit &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 long evaluate (const ibis::qDiscreteRange &expr, ibis::bitvector &hits) const
 To evaluate the exact hits.
virtual long evaluate (const ibis::qContinuousRange &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.
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 (ibis::fileManager::storage *st)
 Read from a reference counted piece of memory.
virtual int read (const char *idxfile)
 Read the content of 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 content of the index to the specified location.

Protected Member Functions

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 *f, const array_t< double > &bd)
 Construct a new index using the given bin boundaries.
virtual size_t getSerialSize () const throw ()
 Get an estimate of the size of index on disk.

Detailed Description

The multi-level range based (cumulative) index.

Each level/each bin consists of a range index.


Constructor & Destructor Documentation

ibis::ambit::ambit ( const ibis::column c,
ibis::fileManager::storage st,
size_t  offset = 8 
)

Reconstruct ambit from content of a storage object.

In addition to the common content for index::bin, the following are inserted after minval array: (this constructor relies the fact that max1 and min1 follow minval immediately without any separation or padding)

    max1 (double) -- the maximum value of all data entry
    min1 (double) -- the minimum value of those larger than or equal to the
                     largest bounds value (bounds[nobs-1])
    offsets_for_next_level ([nobs+1]) -- as the name suggests, these are
                     the offsets (in this file) for the next level ibis::ambit.

After the bit vectors of this level are written, the next level ibis::ambit are written without header.

References ibis::fileManager::storage::begin(), clear(), ibis::index::col, ibis::gVerbose, ibis::column::name(), ibis::part::name(), ibis::bin::nobs, and print().


Member Function Documentation

void ibis::ambit::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().

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

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

Reimplemented from ibis::bin.

void ibis::ambit::clear ( ) [protected, virtual]

Clear the existing content.

Free the objectes pointed to by the pointers.

Reimplemented from ibis::bin.

References ibis::bin::clear().

Referenced by ambit().

double ibis::ambit::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::ambit::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::util::eq2range(), ibis::bitvector::flip(), ibis::gVerbose, ibis::util::incrDouble(), ibis::qContinuousRange::leftBound(), ibis::qContinuousRange::rightBound(), ibis::bitvector::set(), and ibis::bitvector::size().

long ibis::ambit::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::ambit::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::ambit::getSerialSize ( ) const throw () [protected, virtual]

Get an estimate of the size of index on disk.

This function is used to determine whether to use 64-bit offsets or 32-bit offsets. For the purpose of this estimation, we assume 64-bit offsets are needed. This function recursively calls itself to determine the size of sub-indexes.

Reimplemented from ibis::bin.

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

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

Read the content of a file.

The incoming argument can be either a directory name or a file name. The actual index file name is determined by the function indexFileName.

Reimplemented from ibis::bin.

References ibis::index::AMBIT, ibis::gVerbose, ibis::fileManager::instance(), ibis::fileManager::recordPages(), ibis::util::strnewdup(), ibis::array_t< T >::swap(), and UnixOpen.

float ibis::ambit::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::ambit::write ( const char *  dt) const [virtual]

Write the content of the index to the specified location.

The input argument can be either a directory name or a file name. The actual name of the index file is determined by the function indexFileName.

Reimplemented from ibis::bin.

References ibis::index::AMBIT, ibis::fileManager::flushFile(), ibis::gVerbose, ibis::fileManager::instance(), 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