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

A version of precise index that directly uses the integer values. More...

#include <idirekte.h>

Inheritance diagram for ibis::direkte:
ibis::index

List of all members.

Public Member Functions

virtual long append (const char *dt, const char *df, uint32_t nnew)
 Append the index in df to the one in dt.
long append (const ibis::direkte &tail)
 Append tail to this index.
long append (const array_t< uint32_t > &ind)
 Append a list of integers.
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
 direkte (const ibis::column *c, const char *f=0)
 Constructing a new ibis::direkte object from base data in a file.
 direkte (const ibis::column *c, ibis::fileManager::storage *st)
 direkte (const ibis::column *c, uint32_t popu, uint32_t ntpl=0)
 Construct a dummy index.
 direkte (const ibis::column *c, uint32_t card, array_t< uint32_t > &ints)
 Construct an index from an integer array.
virtual void estimate (const ibis::qContinuousRange &expr, ibis::bitvector &lower, ibis::bitvector &upper) const
 Computes an approximation of hits as a pair of lower and upper bounds.
virtual uint32_t estimate (const ibis::qContinuousRange &expr) const
 Returns an upper bound on the number of hits.
virtual void estimate (const ibis::qDiscreteRange &expr, ibis::bitvector &lower, ibis::bitvector &upper) const
 Estimate the hits for discrete ranges, i.e., those translated from 'a IN (x, y, ..)'.
virtual uint32_t estimate (const ibis::qDiscreteRange &expr) const
virtual double estimateCost (const ibis::qContinuousRange &expr) const
 Estimate the cost of evaluating a range condition.
virtual double estimateCost (const ibis::qDiscreteRange &expr) const
 Estimate the cost of evaluating a range condition.
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 long getCumulativeDistribution (std::vector< double > &bds, std::vector< uint32_t > &cts) const
 Cumulative distribution of the data.
virtual long getDistribution (std::vector< double > &bbs, std::vector< uint32_t > &cts) const
 Binned distribution of the data.
virtual double getMax () const
 The maximum value recorded in the index.
virtual double getMin () const
 The minimum value recorded in the index.
virtual double getSum () const
 Compute the approximate sum of all the values indexed.
array_t< uint32_t > * keys (const ibis::bitvector &mask) const
 Convert the bitvector mask into key values.
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
 The printing function.
virtual int read (const char *name)
 Read index from the specified location.
virtual int read (ibis::fileManager::storage *st)
 Reconstruct an index from a piece of consecutive memory.
int remapKeys (const ibis::array_t< uint32_t > &)
 Change the key values to a new set of numbers.
virtual long select (const ibis::qContinuousRange &, void *) const
 Evaluate the range condition and select values.
virtual long select (const ibis::qContinuousRange &, void *, ibis::bitvector &) const
 Evaluate the range condition, select values, and record the positions.
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 float undecidable (const ibis::qDiscreteRange &expr, ibis::bitvector &iffy) const
virtual int write (const char *name) const
 Write the direct bitmap index to a file.

Protected Member Functions

template<typename T >
int construct (const char *f)
template<typename T >
int construct0 (const char *f)
 direkte (const direkte &)
virtual size_t getSerialSize () const throw ()
 Estiamte the size of the index file.
void locate (const ibis::qContinuousRange &expr, uint32_t &hit0, uint32_t &hit1) const
direkteoperator= (const direkte &)

Detailed Description

A version of precise index that directly uses the integer values.

It can avoid some intemdiate steps during index building and query answering. However, this class can only be used with integer column with nonnegative values. Ideally, the values should start with 0, and only use small positive integers.


Constructor & Destructor Documentation

ibis::direkte::direkte ( const ibis::column c,
uint32_t  popu,
uint32_t  ntpl = 0 
)

Construct a dummy index.

All entries have the same value popu. This is used to generate index for meta tags from STAR data.

References ibis::index::bits, ibis::index::clear(), ibis::index::col, direkte(), ibis::gVerbose, ibis::part::name(), ibis::column::name(), ibis::part::nRows(), ibis::index::nrows, print(), and ibis::array_t< T >::resize().


Member Function Documentation

long ibis::direkte::append ( const char *  dt,
const char *  df,
uint32_t  nnew 
) [virtual]
long ibis::direkte::append ( const ibis::direkte tail)

Append tail to this index.

The incoming index must be for the same column as this one.

References ibis::index::activate(), ibis::index::bits, ibis::index::col, ibis::gVerbose, ibis::index::nrows, ibis::bitvector::set(), and ibis::array_t< T >::size().

long ibis::direkte::append ( const array_t< uint32_t > &  ind)

Append a list of integers.

The integers are treated as bin numbers. This function is primarily used by ibis::category::append.

References ibis::gVerbose, ibis::array_t< T >::push_back(), and ibis::array_t< T >::size().

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

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

Reimplemented from ibis::index.

void ibis::direkte::estimate ( const ibis::qContinuousRange ,
ibis::bitvector lower,
ibis::bitvector upper 
) const [virtual]

Computes an approximation of hits as a pair of lower and upper bounds.

Parameters:
exprthe query expression to be evaluated.
lowera bitvector marking a subset of the hits. All rows marked with one (1) are definitely hits.
uppera bitvector marking a superset of the hits. All hits are marked with one, but some of the rows marked one may not be hits. If the variable upper is empty, the variable lower is assumed to contain the exact answer.

Reimplemented from ibis::index.

References ibis::bitvector::clear().

void ibis::direkte::estimate ( const ibis::qDiscreteRange expr,
ibis::bitvector lower,
ibis::bitvector upper 
) const [virtual]

Estimate the hits for discrete ranges, i.e., those translated from 'a IN (x, y, ..)'.

A trivial implementation to indicate the index can not determine any row.

Reimplemented from ibis::index.

References ibis::bitvector::clear(), ibis::qDiscreteRange::getValues(), ibis::bitvector::set(), and ibis::array_t< T >::size().

long ibis::direkte::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.

References ibis::bitvector::cnt().

long ibis::direkte::evaluate ( const ibis::qDiscreteRange ,
ibis::bitvector  
) const [virtual]

To evaluate the exact hits.

On success, return the number of hits, otherwise a negative value is returned.

Reimplemented from ibis::index.

References ibis::bitvector::cnt(), ibis::qDiscreteRange::getValues(), ibis::bitvector::set(), and ibis::array_t< T >::size().

long ibis::direkte::getCumulativeDistribution ( std::vector< double > &  bds,
std::vector< uint32_t > &  cts 
) const [virtual]

Cumulative distribution of the data.

A brute-force approach to get an accurate cumulative distribution.

Reimplemented from ibis::index.

long ibis::direkte::getDistribution ( std::vector< double > &  bbs,
std::vector< uint32_t > &  cts 
) const [virtual]

Binned distribution of the data.

A brute-force approach to get an accurate distribution.

Reimplemented from ibis::index.

size_t ibis::direkte::getSerialSize ( ) const throw () [protected, virtual]

Estiamte the size of the index file.

The index file contains primarily the bitmaps.

double ibis::direkte::getSum ( ) const [virtual]

Compute the approximate sum of all the values indexed.

If it decides that computing the sum directly from the vertical partition is more efficient, it will return NaN immediately.

Reimplemented from ibis::index.

virtual const char* ibis::direkte::name ( ) const [inline, virtual]

Returns the name of the index, similar to the function type, but returns a string instead.

Implements ibis::index.

int ibis::direkte::remapKeys ( const ibis::array_t< uint32_t > &  o2n)

Change the key values to a new set of numbers.

This is used after a categorical value column changes it dictionary and we need to reshuffle the bitmaps but not the actual content in any bitmap. The incoming argument is expected to be an array of exactly the same number of elements as the number of bitmaps in this index.

Return the number of bit vectors after successfully remapped the keys. Otherwise return a negative number.

References ibis::array_t< T >::clear(), ibis::util::clear(), ibis::array_t< T >::copy(), ibis::fileManager::flushFile(), ibis::gVerbose, ibis::fileManager::instance(), ibis::array_t< T >::size(), and ibis::array_t< T >::swap().

Referenced by ibis::category::setDictionary().

virtual void ibis::direkte::speedTest ( std::ostream &  out) const [inline, virtual]

Time some logical operations and print out their speed.

This version does nothing.

Reimplemented from ibis::index.

virtual float ibis::direkte::undecidable ( const ibis::qContinuousRange ,
ibis::bitvector  
) const [inline, 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::index.

References ibis::bitvector::clear().


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