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

A two-level index. More...

#include <ibin.h>

Inheritance diagram for ibis::zone:
ibis::bin ibis::index

List of all members.

Public Member Functions

virtual void adjustLength (uint32_t nrows)
 Fill the bitmaps to the specified size.
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::zone &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::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 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 the metadata of an index from a storage object.
virtual int read (const char *idxfile)
 Read the metadata about an index from the specified location.
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 specified location.
 zone (const ibis::column *c, ibis::fileManager::storage *st, size_t offset=8)
 Reconstruct zone from content of a storage object.
 zone (const ibis::bin &rhs)
 Copy constructor.

Protected Member Functions

virtual void clear ()
 Clear the existing content.
virtual size_t getSerialSize () const throw ()
 Get an estimate of the size of index on disk.

Detailed Description

A two-level index.

Both levels are not cumulative, i.e., both levels are equality encoded.


Constructor & Destructor Documentation

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

Reconstruct zone from content of a storage object.

In addition to the common content for index::bin, the following are inserted after minval array:

    offsets_for_next_level ([nobs+1]) -- as the name suggests, these are
           the offsets (in this file) for the next level ibis::zone.

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

References ibis::fileManager::storage::begin(), ibis::bin::bin(), clear(), ibis::index::col, ibis::gVerbose, ibis::column::name(), ibis::part::name(), ibis::bin::nobs, ibis::index::nrows, print(), and ibis::array_t< T >::size().

ibis::zone::zone ( const ibis::bin rhs) [explicit]

Member Function Documentation

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

void ibis::zone::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::gVerbose, ibis::util::incrDouble(), ibis::qContinuousRange::leftBound(), ibis::qContinuousRange::rightBound(), and ibis::bitvector::set().

long ibis::zone::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::zone::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::zone::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::zone::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::zone::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 zone().

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

Read the metadata about an index from the specified location.

The incoming arugment can be directory name of a file name. The actual index file name is determined by the function indexFileName. It returns 0 on successful completion and a negative number to indicate error.

Reimplemented from ibis::bin.

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

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

Write the index to the specified location.

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

Reimplemented from ibis::bin.

References ibis::index::BINNING, ibis::fileManager::flushFile(), ibis::gVerbose, ibis::fileManager::instance(), UnixOpen, ibis::bin::write32(), ibis::bin::write64(), and ibis::index::ZONE.


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