Public Member Functions | Protected Member Functions | Protected Attributes
ibis::egale Class Reference

The multicomponent equality code on bins. More...

#include <ibin.h>

Inheritance diagram for ibis::egale:
ibis::bin ibis::index ibis::entre ibis::moins

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::egale &tail)
long append (const array_t< uint32_t > &ind)
 Append a list of integers representing bin numbers.
virtual void binBoundaries (std::vector< double > &b) const
 The function binBoundaries and binWeights return bin boundaries and counts of each bin respectively.
virtual void binWeights (std::vector< uint32_t > &b) const
 egale (const ibis::column *c=0, const char *f=0, const uint32_t nbase=2)
 Construct a bitmap index from current base data.
 egale (const ibis::column *c, ibis::fileManager::storage *st, size_t offset=8)
 Constructor.
 egale (const ibis::bin &rhs, const uint32_t nbase=2)
 Constructor.
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 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 void print (std::ostream &out) const
 The printing function.
virtual int read (const char *idxfile)
 Read from a file named f.
virtual int read (ibis::fileManager::storage *st)
 Read an index from a storage object.
virtual void speedTest (std::ostream &out) const
 A simple function to test the speed of the bitvector operations.
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 index to a specified location.

Protected Member Functions

void addBits_ (uint32_t ib, uint32_t ie, 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 *f)
 Generate a new egale index by directly setting the bits in the multicomponent bitvectors.
 egale (const ibis::column *c, const char *f, const array_t< double > &bd, const array_t< uint32_t > bs)
 Constructor. It takes a set of known bin bounds and bases.
virtual size_t getSerialSize () const throw ()
 Estimate the size of the index on disk.
int write32 (int fdes) const
 Write the index to an open file.
int write64 (int fdes) const
 Write the index to an open file.

Protected Attributes

array_t< uint32_t > bases
array_t< uint32_t > cnts
uint32_t nbases
uint32_t nbits

Detailed Description

The multicomponent equality code on bins.

The word egale is a French word for 'equal'.


Constructor & Destructor Documentation

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

Constructor.

Reconstruct an index from content of a storage object. The content of the file (following the 8-byte header) is:

    nrows  (uint32_t)        -- number of bits in a bitvector
    nobs   (uint32_t)        -- number of bins
    nbits  (uint32_t)        -- number of bitvectors
           padding to ensure bounds starts on multiple of 8.
    bounds (double[nobs])    -- bind boundaries
    maxval (double[nobs])    -- the maximum value in each bin
    minval (double[nobs])    -- the minimum value in each bin
    offset ([nbits+1])       -- starting position of the bitvectors
    cnts   (uint32_t[nobs])  -- number of records in each bin
    nbases (uint32_t)        -- number of components (size of array bases)
    bases  (uint32_t[nbases])-- the bases sizes
    bitvectors               -- the bitvectors one after another

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

ibis::egale::egale ( const ibis::bin rhs,
const uint32_t  nbase = 2 
)

Constructor.

Convert an ibis::bin object into a multi-component equality encoded index.

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


Member Function Documentation

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

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

Reimplemented from ibis::bin.

virtual void ibis::egale::clear ( ) [inline, protected, virtual]

Clear the existing content.

Free the objectes pointed to by the pointers.

Reimplemented from ibis::bin.

References ibis::array_t< T >::clear(), and ibis::bin::clear().

Referenced by egale(), and ibis::moins::moins().

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

Reimplemented in ibis::entre, and ibis::moins.

References ibis::bitvector::cnt().

void ibis::egale::construct ( const char *  f) [protected]

Generate a new egale index by directly setting the bits in the multicomponent bitvectors.

The alternative was to build a simple equality index first than convert. Directly build the multicomponent scheme might use less space, at least we donot have to generate the simple encoding, however in many tests it takes longer time.

Reimplemented from ibis::bin.

References ibis::bitvector::adjustSize(), ibis::bitvector::bitsPerLiteral(), ibis::CATEGORY, ibis::bitvector::copy(), ibis::DOUBLE, ibis::FLOAT, ibis::fileManager::getFile(), ibis::gVerbose, ibis::bitvector::indexSet::indices(), ibis::fileManager::instance(), ibis::INT, ibis::bitvector::indexSet::isRange(), ibis::bitvector::indexSet::nIndices(), ibis::bitvector::set(), ibis::array_t< T >::size(), ibis::bitvector::size(), ibis::TEXT, and ibis::UINT.

Referenced by ibis::moins::append(), ibis::entre::append(), and egale().

void ibis::egale::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.

Reimplemented in ibis::entre, and ibis::moins.

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

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

Reimplemented in ibis::entre, and ibis::moins.

References ibis::bitvector::cnt(), and ibis::bitvector::size().

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

Reimplemented in ibis::entre, and ibis::moins.

References ibis::range::evaluate().

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

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

Reimplemented from ibis::bin.

Reimplemented in ibis::entre, and ibis::moins.

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

Write the content of index to a specified location.

The argument can be the name of the directory or the name of the file.

Reimplemented from ibis::bin.

Reimplemented in ibis::entre, and ibis::moins.

References ibis::index::EGALE, 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