Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
ibis::bord Class Reference

Class ibis::bord stores all its data in memory. More...

#include <bord.h>

Inheritance diagram for ibis::bord:
ibis::table ibis::part

Classes

class  column
 An in-memory version of ibis::column. More...
 
class  cursor
 

Public Member Functions

int append (const ibis::selectClause &, const ibis::part &, const ibis::bitvector &)
 Append the values marked 1 to this data partition. More...
 
int append (const ibis::selectClause &, const ibis::part &, const ibis::qContinuousRange &)
 Append the rows satisfying the specified range expression. More...
 
virtual int backup (const char *dir, const char *tname=0, const char *tdesc=0) const
 Write the content of partition into the specified directory dir. More...
 
 bord (const char *tn, const char *td, uint64_t nr, ibis::table::bufferArray &buf, const ibis::table::typeArray &ct, const ibis::table::stringArray &cn, const ibis::table::stringArray *cdesc=0, const std::vector< const ibis::dictionary * > *dct=0)
 Constructor. More...
 
 bord (const char *tn, const char *td, const ibis::selectClause &sc, const ibis::part &ref)
 Constructor. More...
 
 bord (const char *tn, const char *td, const ibis::selectClause &sc, const ibis::constPartList &ref)
 Constructor. More...
 
 bord (const std::vector< ibis::bord::column * > &cols, uint32_t nr=0)
 Constructor. More...
 
virtual int buildIndex (const char *, const char *)
 The following functions deal with auxillary data for accelerating query processing, primarily for building indexes. More...
 
virtual int buildIndexes (const ibis::table::stringArray &)
 The following functions deal with auxillary data for accelerating query processing, primarily for building indexes. More...
 
virtual int buildIndexes (const char *)
 Create indexes for every column of the table. More...
 
virtual ibis::table::stringArray columnNames () const
 
virtual ibis::table::typeArray columnTypes () const
 !< Return column names.
 
void copyColumn (const char *, ibis::TYPE_T &, void *&, const ibis::dictionary *&) const
 Copy the type and values of the named column. More...
 
virtual ibis::table::cursorcreateCursor () const
 Create a cursor object to perform row-wise data access.
 
virtual void describe (std::ostream &) const
 !< Return data types. More...
 
virtual int dump (std::ostream &, const char *) const
 Print the values in ASCII form to the specified output stream. More...
 
virtual int dump (std::ostream &, uint64_t, const char *) const
 Print the first nr rows of the data to the given output stream. More...
 
virtual int dump (std::ostream &, uint64_t, uint64_t, const char *) const
 Print nr rows starting with row offset. More...
 
virtual int dumpJSON (std::ostream &, uint64_t) const
 Dump out the first nr rows in JSON format.
 
virtual void dumpNames (std::ostream &, const char *) const
 Print all column names on one line.
 
virtual void estimate (const char *cond, uint64_t &nmin, uint64_t &nmax) const
 Estimate the number of rows satisfying the selection conditions. More...
 
virtual void estimate (const ibis::qExpr *cond, uint64_t &nmin, uint64_t &nmax) const
 Estimate the number of rows satisfying the selection conditions. More...
 
ibis::bordevaluateTerms (const ibis::selectClause &, const char *) const
 Evaluate the arithmetic expressions in the select clause to derive an in-memory data table. More...
 
virtual int64_t getColumnAsBytes (const char *, char *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column. More...
 
virtual int64_t getColumnAsDoubles (const char *, double *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column. More...
 
virtual int64_t getColumnAsDoubles (const char *, std::vector< double > &, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column. More...
 
virtual int64_t getColumnAsFloats (const char *, float *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column. More...
 
virtual int64_t getColumnAsInts (const char *, int32_t *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column. More...
 
virtual int64_t getColumnAsLongs (const char *, int64_t *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column. More...
 
virtual int64_t getColumnAsOpaques (const char *, std::vector< ibis::opaque > &, uint64_t=0, uint64_t=0) const
 Retrieve the blobs as ibis::opaque objects. More...
 
virtual int64_t getColumnAsShorts (const char *, int16_t *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column. More...
 
virtual int64_t getColumnAsStrings (const char *, std::vector< std::string > &, uint64_t=0, uint64_t=0) const
 Retrieve the null-terminated strings as a vector of std::string objects. More...
 
virtual int64_t getColumnAsUBytes (const char *, unsigned char *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column. More...
 
virtual int64_t getColumnAsUInts (const char *, uint32_t *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column. More...
 
virtual int64_t getColumnAsULongs (const char *, uint64_t *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column. More...
 
virtual int64_t getColumnAsUShorts (const char *, uint16_t *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column. More...
 
virtual double getColumnMax (const char *) const
 Compute the maximum of all valid values in the name column. More...
 
virtual double getColumnMin (const char *) const
 Compute the minimum of all valid values in the name column. More...
 
virtual long getHistogram (const char *, const char *, double, double, double, std::vector< uint32_t > &) const
 
virtual long getHistogram2D (const char *, const char *, double, double, double, const char *, double, double, double, std::vector< uint32_t > &) const
 Compute a two-dimension histogram on columns cname1 and cname2. More...
 
virtual long getHistogram3D (const char *, const char *, double, double, double, const char *, double, double, double, const char *, double, double, double, std::vector< uint32_t > &) const
 Compute a three-dimensional histogram on the named columns. More...
 
virtual int getPartitions (constPartList &) const
 
virtual tablegroupby (const ibis::table::stringArray &) const
 Perform aggregate functions on the current table. More...
 
virtual tablegroupby (const char *str) const
 Perform a group-by operation. More...
 
ibis::tablegroupby (const ibis::selectClause &) const
 
virtual void indexSpec (const char *, const char *)
 Replace the current indexing option. More...
 
virtual const char * indexSpec (const char *) const
 Retrieve the current indexing option. More...
 
int limit (uint32_t)
 Reset the number of rows in the data partition to be nr. More...
 
int merge (const ibis::bord &, const ibis::selectClause &)
 Merge the incoming data partition with this one. More...
 
virtual uint32_t nColumns () const
 The number of columns in this table.
 
virtual uint64_t nRows () const
 The number of rows in this table.
 
virtual void orderby (const ibis::table::stringArray &)
 Reorder the rows. More...
 
virtual void orderby (const ibis::table::stringArray &, const std::vector< bool > &)
 
int renameColumns (const ibis::selectClause &)
 
virtual long reorder ()
 Sort rows with the lowest cardinality column first. More...
 
virtual long reorder (const ibis::table::stringArray &)
 Reorder the rows using the given column list.
 
virtual long reorder (const ibis::table::stringArray &, const std::vector< bool > &)
 Sort rows according the values of the columns specified in names. More...
 
long reorderStrings (std::vector< std::string > &vals, const array_t< uint32_t > &ind) const
 Reorder the vector of strings. More...
 
template<typename T >
long reorderValues (array_t< T > &vals, const array_t< uint32_t > &ind) const
 
int restoreCategoriesAsStrings (const ibis::part &)
 Convert the integer representation of categorical columns back to the string representation. More...
 
virtual void reverseRows ()
 Reverse the order of the rows.
 
virtual tableselect (const char *sel, const char *cond) const
 Given a set of column names and a set of selection conditions, compute another table that represents the selected values. More...
 
long sortStrings (std::vector< std::string > &vals, array_t< uint32_t > &starts, array_t< uint32_t > &idxout, const array_t< uint32_t > &idxin, bool ascending) const
 Sort the string values. More...
 
template<typename T >
long sortValues (array_t< T > &vals, array_t< uint32_t > &starts, array_t< uint32_t > &indout, const array_t< uint32_t > &indin, bool ascending) const
 A simple sorting procedure. More...
 
ibis::tablexgroupby (const ibis::selectClause &) const
 The actual function to perform the group by operation. More...
 
- Public Member Functions inherited from ibis::table
virtual int addPartition (const char *)
 Add a data partition defined in the named directory. More...
 
virtual const char * description () const
 Free text description. May return a null pointer.
 
virtual int dropPartition (const char *)
 Remove the named data partition from this data table. More...
 
virtual int getPartitions (ibis::constPartList &) const
 Retrieve the list of partitions.
 
virtual const char * name () const
 Name of the table. More...
 
virtual void orderby (const char *)
 Reorder the rows. The column names are separated by commas.
 
virtual tableselect (const char *sel, const ibis::qExpr *cond) const
 Process the selection conditions and generate another table to hold the answer. More...
 
virtual ~table ()
 Destructor.
 
virtual int mergeCategories (const stringArray &)
 Merge the dictionaries of categorical value from different data partitions. More...
 
- Public Member Functions inherited from ibis::part
virtual int buildIndexes (const char *iopt, int nthr)
 Make sure indexes for all columns are available. More...
 
virtual int buildIndexes (const ibis::table::stringArray &, int nthr=1)
 Make sure indexes for all columns are available. More...
 
void buildSorted (const char *colname) const
 Build a sorted version of the specified column. More...
 
long calculate (const ibis::math::term &, const ibis::bitvector &, array_t< double > &) const
 Calculate the values of an arithmetic expression as doubles. More...
 
long calculate (const ibis::math::stringFunction1 &, const ibis::bitvector &, std::vector< std::string > &) const
 Calculate the values of a math expression as strings. More...
 
ibis::table::stringArray columnNames () const
 Return column names in a list. More...
 
ibis::table::typeArray columnTypes () const
 Return column types in a list.
 
void combineNames (ibis::table::namesTypes &metalist) const
 Update the list of columns with information in this data partition.
 
void computeMinMax ()
 Compute the min and max for each column. More...
 
long countHits (const ibis::qRange &cmp) const
 Count the number of hits for a single range condition.
 
const char * currentDataDir () const
 Return the name of the active data directory.
 
const char * description () const
 Return a text description of the partition.
 
virtual long doScan (const ibis::qRange &cmp, ibis::bitvector &hits) const
 Evaluate the range condition. More...
 
virtual long doScan (const ibis::qRange &cmp, const ibis::bitvector &mask, ibis::bitvector &hits) const
 Evalute the range condition on the records that are marked 1 in the mask. More...
 
virtual long doScan (const ibis::qRange &cmp, const ibis::bitvector &mask, void *res) const
 Evalute the range condition and record the values satisfying the condition in res. More...
 
virtual long doScan (const ibis::qRange &cmp, const ibis::bitvector &mask, void *res, ibis::bitvector &hits) const
 Evalute the range condition and record the values satisfying the condition in res. More...
 
virtual long doScan (const ibis::math::term &, const ibis::bitvector &, ibis::bitvector &) const
 Treat the arithmetic expression as true or false. More...
 
virtual long doScan (const ibis::compRange &cmp, ibis::bitvector &hits) const
 Sequential scan without a mask. More...
 
virtual long doScan (const ibis::compRange &cmp, const ibis::bitvector &mask, ibis::bitvector &hits) const
 Locate the records that have mark value 1 and satisfy the complex range conditions. More...
 
template<typename T >
long doScan (const array_t< T > &vals, const ibis::qContinuousRange &rng, const ibis::bitvector &mask, ibis::bitvector &hits)
 Evalue the range condition on the in memory values. More...
 
template<>
long doScan (const array_t< float > &vals, const ibis::qContinuousRange &rng, const ibis::bitvector &mask, ibis::bitvector &hits)
 Examine the range condition with in memory values. More...
 
template<>
long doScan (const array_t< double > &vals, const ibis::qContinuousRange &rng, const ibis::bitvector &mask, ibis::bitvector &hits)
 Examine the range condition with in memory values. More...
 
template<typename T >
long doScan (const array_t< T > &vals, const ibis::qContinuousRange &rng, const ibis::bitvector &mask, array_t< T > &res)
 Evalue the range condition on the in memory values. More...
 
template<typename T >
long doScan (const array_t< T > &vals, const ibis::qContinuousRange &rng, const ibis::bitvector &mask, array_t< T > &res, ibis::bitvector &hits)
 Evalue the range condition on the in memory values. More...
 
template<>
long doScan (const array_t< float > &vals, const ibis::qContinuousRange &rng, const ibis::bitvector &mask, array_t< float > &res)
 Examine the range condition with in memory values. More...
 
template<>
long doScan (const array_t< double > &vals, const ibis::qContinuousRange &rng, const ibis::bitvector &mask, array_t< double > &res)
 Examine the range condition with in memory values. More...
 
template<>
long doScan (const array_t< float > &vals, const ibis::qContinuousRange &rng, const ibis::bitvector &mask, array_t< float > &res, ibis::bitvector &hits)
 Examine the range condition with in memory values. More...
 
template<>
long doScan (const array_t< double > &vals, const ibis::qContinuousRange &rng, const ibis::bitvector &mask, array_t< double > &res, ibis::bitvector &hits)
 Examine the range condition with in memory values. More...
 
template<>
void equalWeightBins (const array_t< float > &vals, uint32_t nbins, array_t< float > &bounds)
 Explicit specialization for float arrays. More...
 
template<>
void equalWeightBins (const array_t< double > &vals, uint32_t nbins, array_t< double > &bounds)
 Explicit specialization for double arrays. More...
 
virtual double estimateCost (const ibis::qContinuousRange &cmp) const
 Estimate the cost of evaluate the query expression.
 
virtual double estimateCost (const ibis::qDiscreteRange &cmp) const
 Estimate the cost of evaluate the query expression.
 
virtual double estimateCost (const ibis::qIntHod &cmp) const
 Estimate the cost of evaluate the query expression.
 
virtual double estimateCost (const ibis::qUIntHod &cmp) const
 Estimate the cost of evaluate the query expression.
 
virtual double estimateCost (const ibis::qString &cmp) const
 Estimate the cost of evaluate the query expression.
 
virtual double estimateCost (const ibis::qAnyString &cmp) const
 Estimate the cost of evaluate the query expression.
 
virtual long estimateMatchAny (const ibis::qAnyAny &cmp, ibis::bitvector &low, ibis::bitvector &high) const
 Estimate a lower bound and an upper bound on the records that are hits. More...
 
virtual long estimateRange (const ibis::qContinuousRange &cmp) const
 Return an upper bound on the number of hits.
 
virtual long estimateRange (const ibis::qDiscreteRange &cmp) const
 Return an upper bound on the number of hits.
 
virtual long estimateRange (const ibis::qIntHod &cmp) const
 Return an upper bound on the number of hits.
 
virtual long estimateRange (const ibis::qUIntHod &cmp) const
 Return an upper bound on the number of hits.
 
virtual long estimateRange (const ibis::qContinuousRange &cmp, ibis::bitvector &low, ibis::bitvector &high) const
 Estimate a continuous range condition. More...
 
virtual long estimateRange (const ibis::qDiscreteRange &cmp, ibis::bitvector &low, ibis::bitvector &high) const
 Estimate the discrete range condition.
 
virtual long estimateRange (const ibis::qIntHod &cmp, ibis::bitvector &low, ibis::bitvector &high) const
 Estimate the discrete range condition.
 
virtual long estimateRange (const ibis::qUIntHod &cmp, ibis::bitvector &low, ibis::bitvector &high) const
 Estimate the discrete range condition.
 
int64_t evaluateJoin (const ibis::deprecatedJoin &cmp, const ibis::bitvector &mask, ibis::bitvector64 &pairs) const
 Evaluate a self-join. More...
 
int64_t evaluateJoin (const ibis::deprecatedJoin &cmp, const ibis::bitvector &mask, const char *pairfile) const
 Return the number of pairs satisfying the join condition. More...
 
int64_t evaluateJoin (const ibis::deprecatedJoin &cmp, const ibis::bitvector &mask) const
 Return only the number of pairs satisfying the join condition.
 
int64_t evaluateJoin (const std::vector< const ibis::deprecatedJoin * > &cmp, const ibis::bitvector &mask, ibis::bitvector64 &pairs) const
 Evaluate a join defined with multiple (conjunctive) range join conditions. More...
 
int64_t evaluateJoin (const std::vector< const ibis::deprecatedJoin * > &cmp, const ibis::bitvector &mask) const
 
int64_t evaluateJoin (const ibis::deprecatedJoin &cmp, const ibis::bitvector64 &trial, ibis::bitvector64 &result) const
 Evaluate all pairs in trial to determine whether they really satisfy the range join defined in cmp. More...
 
int64_t evaluateJoin (const std::vector< const ibis::deprecatedJoin * > &cmp, const ibis::bitvector64 &trial, ibis::bitvector64 &result) const
 Check a set of pairs defined in trial. More...
 
virtual long evaluateRange (const ibis::qContinuousRange &cmp, const ibis::bitvector &mask, ibis::bitvector &res) const
 Evaluate a continue range expression accurately.
 
virtual long evaluateRange (const ibis::qDiscreteRange &cmp, const ibis::bitvector &mask, ibis::bitvector &res) const
 Evaluate a discrete range expression accurately.
 
virtual long evaluateRange (const ibis::qIntHod &cmp, const ibis::bitvector &mask, ibis::bitvector &res) const
 Evaluate a discrete range expression accurately.
 
virtual long evaluateRange (const ibis::qUIntHod &cmp, const ibis::bitvector &mask, ibis::bitvector &res) const
 Evaluate a discrete range expression accurately.
 
long evaluateRIDSet (const ibis::RIDSet &, ibis::bitvector &) const
 Convert a list of RIDs into a bitvector. More...
 
bool explicitRIDs () const
 Does this partition have an explicit RID column? Returns true for yes, false for no. More...
 
double getActualMax (const char *name) const
 The actual maximum value in the named column.
 
double getActualMin (const char *name) const
 The actual minimum value in the named column.
 
columngetColumn (const char *name) const
 Given a name, return the associated column. More...
 
columngetColumn (uint32_t ind) const
 Returns the pointer to the ith column. More...
 
double getColumnSum (const char *name) const
 Sum of all value in the named column.
 
infogetInfo () const
 Return an ibis::part::info object that describes the current partition.
 
const std::vector< std::string > & getMeshDimensions () const
 Return the name of the dimensions corresponding to the vector returned from getMeshShape. More...
 
const std::vector< uint32_t > & getMeshShape () const
 In many scientific applications, data are defined on meshes. More...
 
const char * getMetaTag (const char *) const
 Return the value of the meta tag with the specified name.
 
array_t< rid_t > * getRIDs () const
 
array_t< rid_t > * getRIDs (const ibis::bitvector &mask) const
 Retrieve the RIDs corresponding to mask[i] == 1. More...
 
uint32_t getRowNumber (const rid_t &rid) const
 Return the row number of the row with specified RID. More...
 
TABLE_STATE getState () const
 Retrieve the current state of data partition. More...
 
TABLE_STATE getStateNoLocking () const
 Return the current state of data partition.
 
virtual float getUndecidable (const ibis::qContinuousRange &cmp, ibis::bitvector &iffy) const
 Discover the records that can not be decided using the index. More...
 
virtual float getUndecidable (const ibis::qDiscreteRange &cmp, ibis::bitvector &iffy) const
 Discover the records that can not be decided using the index.
 
virtual float getUndecidable (const ibis::qIntHod &cmp, ibis::bitvector &iffy) const
 Discover the records that can not be decided using the index.
 
virtual float getUndecidable (const ibis::qUIntHod &cmp, ibis::bitvector &iffy) const
 Discover the records that can not be decided using the index.
 
const char * indexSpec () const
 Return the current index specification.
 
void indexSpec (const char *)
 Replace existing index specification with a new one.
 
long keywordSearch (const ibis::qKeyword &cmp, ibis::bitvector &low) const
 Identify all rows containing the specified keyword. More...
 
long keywordSearch (const ibis::qAllWords &cmp, ibis::bitvector &low) const
 Determine the records that have all specified keywords. More...
 
long keywordSearch (const ibis::qKeyword &cmp) const
 Return an upper bound of the number of records that have the keyword.
 
long keywordSearch (const ibis::qAllWords &cmp) const
 Compute an upper bound on the number of rows with all the specified keywords. More...
 
void loadIndexes (const char *iopt=0, int ropt=0) const
 Load indexes of all columns. More...
 
void logMessage (const char *event, const char *fmt,...) const
 
void logWarning (const char *event, const char *fmt,...) const
 
virtual long matchAny (const ibis::qAnyAny &cmp, ibis::bitvector &hits) const
 
virtual long matchAny (const ibis::qAnyAny &cmp, const ibis::bitvector &mask, ibis::bitvector &hits) const
 Perform exact match operation for an AnyAny query. More...
 
bool matchMetaTags (const std::vector< const char * > &mtags) const
 Match multiple name-value pairs against the internally stored meta tags. More...
 
bool matchMetaTags (const ibis::resource::vList &mtags) const
 Match multiple name-value pairs. More...
 
bool matchNameValuePair (const char *name, const char *value) const
 Match a name-value pair in the meta tags. More...
 
std::string metaTags () const
 Return the list of meta tags as a single string. More...
 
const char * name () const
 Return the name of the partition.
 
uint32_t nColumns () const
 Return the number of attributes in the partition.
 
virtual long negativeScan (const ibis::qRange &cmp, const ibis::bitvector &mask, ibis::bitvector &hits) const
 Compute the records (marked 1 in the mask) that does not satisfy the range condition. More...
 
uint32_t nRows () const
 Return the number of rows.
 
 part (const char *name=0, bool ro=false)
 Initialize a data partition object. More...
 
 part (const char *adir, const char *bdir, bool ro=false)
 Initialize a table from the named directories. More...
 
 part (const std::vector< const char * > &mtags, bool ro=false)
 Initialize a partition with given meta tags. More...
 
 part (const ibis::resource::vList &mtags, bool ro=false)
 Initialize a partition with given meta tags. More...
 
long patternSearch (const ibis::qLike &cmp, ibis::bitvector &low) const
 Look for string like the given pattern.
 
long patternSearch (const ibis::qLike &cmp) const
 Look for string like the given pattern.
 
void print (std::ostream &out) const
 Output a description of every column in the data partition. More...
 
void purgeIndexFiles () const
 Remove existing index files! The indexes will be rebuilt next time they are needed. More...
 
array_t< signed char > * selectBytes (const char *name, const ibis::bitvector &mask) const
 Retrieve values of the named column as 8-bit integers. More...
 
array_t< double > * selectDoubles (const char *name, const ibis::bitvector &mask) const
 Retrieve values of the named column as 64-bit floating-point values. More...
 
array_t< float > * selectFloats (const char *name, const ibis::bitvector &mask) const
 Retrieve values of the named column as 32-bit floating-point values. More...
 
array_t< int32_t > * selectInts (const char *name, const ibis::bitvector &mask) const
 Retrieve values of the named column as 32-bit integers. More...
 
array_t< int64_t > * selectLongs (const char *name, const ibis::bitvector &mask) const
 Retrieve values of the named column as 64-bit integers. More...
 
array_t< int16_t > * selectShorts (const char *name, const ibis::bitvector &mask) const
 Retrieve values of the named column as 16-bit integers. More...
 
std::vector< std::string > * selectStrings (const char *name, const ibis::bitvector &mask) const
 Retrieve values of the named column as strings. More...
 
array_t< unsigned char > * selectUBytes (const char *name, const ibis::bitvector &mask) const
 Retrieve values of the named column as 8-bit unsigned integers. More...
 
array_t< uint32_t > * selectUInts (const char *name, const ibis::bitvector &mask) const
 Retrieve values of the named column as 32-bit unsigned integers. More...
 
array_t< uint64_t > * selectULongs (const char *name, const ibis::bitvector &mask) const
 Retrieve values of the named column as 64-bit unsigned integers. More...
 
array_t< uint16_t > * selectUShorts (const char *name, const ibis::bitvector &mask) const
 Retrieve values of the named column as 16-bit unsigned integers. More...
 
long selectValues (const char *cname, const ibis::bitvector &mask, void *vals) const
 Select values of a column based on the given mask.
 
long selectValues (const ibis::qContinuousRange &cond, void *vals) const
 Select values of the column based on the range condition. More...
 
virtual long selfTest (int nth=1, const char *pref=0) const
 Perform predefined set of tests and return the number of failures.
 
void setMeshShape (const ibis::array_t< uint64_t > &)
 copy the incoming as the mesh shape of the data partition.
 
void setMeshShape (const char *shape)
 Digest the mesh shape stored in the string. More...
 
long stringSearch (const ibis::qString &cmp, ibis::bitvector &low) const
 Find all records that has the exact string value. More...
 
long stringSearch (const ibis::qAnyString &cmp, ibis::bitvector &low) const
 Determine the records that have the exact string values. More...
 
long stringSearch (const ibis::qString &cmp) const
 Return an upper bound of the number of records that have the exact string value. More...
 
long stringSearch (const ibis::qAnyString &cmp) const
 
time_t timestamp () const
 Return the time stamp on the partition.
 
void unloadIndexes () const
 Unload indexes of all columns.
 
void updateMetaData () const
 Write the metadata file to record the changes to the partition. More...
 
virtual ~part ()
 Destuctor.
 
long get1DDistribution (const char *constraints, const char *cname, double begin, double end, double stride, std::vector< uint32_t > &counts) const
 Histogram functions. More...
 
long get2DDistribution (const char *constraints, const char *cname1, double begin1, double end1, double stride1, const char *cname2, double begin2, double end2, double stride2, std::vector< uint32_t > &counts) const
 Compute conditional 2D histogram with regularly spaced bins. More...
 
long get3DDistribution (const char *constraints, const char *cname1, double begin1, double end1, double stride1, const char *cname2, double begin2, double end2, double stride2, const char *cname3, double begin3, double end3, double stride3, std::vector< uint32_t > &counts) const
 Compute conditional 3D histogram with regularly spaced bins. More...
 
long get1DDistribution (const char *constraints, const char *cname, double begin, double end, double stride, const char *wtname, std::vector< double > &weights) const
 Compute weighted conditional 1D histogram with regularly spaced bins. More...
 
long get2DDistribution (const char *constraints, const char *cname1, double begin1, double end1, double stride1, const char *cname2, double begin2, double end2, double stride2, const char *wtname, std::vector< double > &weights) const
 Compute weighted conditional 2D histogram with regularly spaced bins. More...
 
long get3DDistribution (const char *constraints, const char *cname1, double begin1, double end1, double stride1, const char *cname2, double begin2, double end2, double stride2, const char *cname3, double begin3, double end3, double stride3, const char *wtname, std::vector< double > &weights) const
 Compute weighted conditional 3D histogram with regularly spaced bins. More...
 
long get1DDistribution (const char *cname, uint32_t nbin, std::vector< double > &bounds, std::vector< uint32_t > &counts) const
 Compute 1D histogram with adaptive bins. More...
 
long get1DDistribution (const char *constraints, const char *cname, uint32_t nbin, std::vector< double > &bounds, std::vector< uint32_t > &counts) const
 Compute conditional 1D histogram with adaptive bins. More...
 
long get2DDistribution (const char *cname1, const char *cname2, uint32_t nb1, uint32_t nb2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< uint32_t > &counts, const char *const option=0) const
 Compute 2D histogram with adaptive bins. More...
 
long get2DDistribution (const char *constraints, const char *name1, const char *name2, uint32_t nb1, uint32_t nb2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< uint32_t > &counts) const
 Compute conditional 2D histogram with adaptive bins. More...
 
long get3DDistribution (const char *cname1, const char *cname2, const char *cname3, uint32_t nb1, uint32_t nb2, uint32_t nb3, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< double > &bounds3, std::vector< uint32_t > &counts, const char *const option=0) const
 Compute 3D histogram with adaptive bins. More...
 
long get3DDistribution (const char *constraints, const char *cname1, const char *cname2, const char *cname3, uint32_t nb1, uint32_t nb2, uint32_t nb3, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< double > &bounds3, std::vector< uint32_t > &counts) const
 Compute conditional 3D histogram with adaptive bins. More...
 
long get1DBins (const char *constraints, const char *cname, double begin, double end, double stride, std::vector< ibis::bitvector > &bins) const
 Partition values of the named variable into regularly spaced bins. More...
 
long get1DBins (const char *constraints, const char *cname, double begin, double end, double stride, std::vector< ibis::bitvector * > &bins) const
 Partition values of the named variable into regularly spaced bins. More...
 
long get1DBins (const char *constraints, const char *cname, double begin, double end, double stride, const char *wtname, std::vector< double > &weights, std::vector< ibis::bitvector * > &bins) const
 Partition values of the named variable into regularly spaced bins. More...
 
long get2DBins (const char *constraints, const char *cname1, double begin1, double end1, double stride1, const char *cname2, double begin2, double end2, double stride2, std::vector< ibis::bitvector > &bins) const
 Partition values of named variables into regularly spaced 2D bins. More...
 
long get2DBins (const char *constraints, const char *cname1, double begin1, double end1, double stride1, const char *cname2, double begin2, double end2, double stride2, std::vector< ibis::bitvector * > &bins) const
 Partition values of named variables into regularly spaced 2D bins. More...
 
long get2DBins (const char *constraints, const char *cname1, double begin1, double end1, double stride1, const char *cname2, double begin2, double end2, double stride2, const char *wtname, std::vector< double > &weights, std::vector< ibis::bitvector * > &bins) const
 Partition values of named variables into regularly spaced 2D bins. More...
 
long get3DBins (const char *constraints, const char *cname1, double begin1, double end1, double stride1, const char *cname2, double begin2, double end2, double stride2, const char *cname3, double begin3, double end3, double stride3, std::vector< ibis::bitvector > &bins) const
 Partition values of named variables into regularly spaced 3D bins. More...
 
long get3DBins (const char *constraints, const char *cname1, double begin1, double end1, double stride1, const char *cname2, double begin2, double end2, double stride2, const char *cname3, double begin3, double end3, double stride3, std::vector< ibis::bitvector * > &bins) const
 Partition values of named variables into regularly spaced 3D bins. More...
 
long get3DBins (const char *constraints, const char *cname1, double begin1, double end1, double stride1, const char *cname2, double begin2, double end2, double stride2, const char *cname3, double begin3, double end3, double stride3, const char *wtname, std::vector< double > &weights, std::vector< ibis::bitvector * > &bins) const
 Partition values of named variables into regularly spaced 3D bins. More...
 
long get1DBins (const char *constraints, const char *cname1, uint32_t nb1, std::vector< double > &bounds1, std::vector< ibis::bitvector > &bins) const
 Partition records satisfying specified conditions into bins with about the same number of records. More...
 
long get2DBins (const char *constraints, const char *cname1, const char *cname2, uint32_t nb1, uint32_t nb2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< ibis::bitvector > &bins) const
 Partition records satisfying specified conditions into 2D bins. More...
 
long get3DBins (const char *constraints, const char *cname1, const char *cname2, const char *cname3, uint32_t nb1, uint32_t nb2, uint32_t nb3, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< double > &bounds3, std::vector< ibis::bitvector > &bins) const
 Partition records satisfying specified conditions into 3D bins. More...
 
long getDistribution (const char *name, std::vector< double > &bounds, std::vector< uint32_t > &counts) const
 Obsolete histogram functions. More...
 
long getDistribution (const char *constraints, const char *name, std::vector< double > &bounds, std::vector< uint32_t > &counts) const
 Compute the conditional binned data distribution. More...
 
long getDistribution (const char *name, uint32_t nbc, double *bounds, uint32_t *counts) const
 Compute the binned distribution with the specified maximum number of bins. More...
 
long getDistribution (const char *name, const char *constraints, uint32_t nbc, double *bounds, uint32_t *counts) const
 Compute the conditional binned data distribution with the specified maximum number of bins. More...
 
long getJointDistribution (const char *constraints, const char *name1, const char *name2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< uint32_t > &counts) const
 Compute the joint distribution of two variables. More...
 
long getCumulativeDistribution (const char *name, std::vector< double > &bounds, std::vector< uint32_t > &counts) const
 Compute a cumulative distribution (a cumulative histogram). More...
 
long getCumulativeDistribution (const char *constraints, const char *name, std::vector< double > &bounds, std::vector< uint32_t > &counts) const
 Compute the cumulative distribution of the variable named name under the specified constraints. More...
 
long getCumulativeDistribution (const char *name, uint32_t nbc, double *bounds, uint32_t *counts) const
 This version of getCumulativeDistribution uses two user supplied arrays bounds and counts. More...
 
long getCumulativeDistribution (const char *constraints, const char *name, uint32_t nbc, double *bounds, uint32_t *counts) const
 Compute the conditional distribution and return the distribution in the arrays provided. More...
 
int clear ()
 A group of functions to manipulate the data partition. More...
 
int updateData ()
 Check the time stamp on the metadata files to decide if the in-memory metadata information requires updating. More...
 
long append (const char *dir)
 Append data from dir. More...
 
long commit (const char *dir)
 Commit the append operation involving data from dir. More...
 
long rollback ()
 Rollback the append operation. More...
 
long addColumn (const char *aexpr, const char *cname, ibis::TYPE_T ctype=ibis::DOUBLE)
 Add a column computed with the given arithmetic expression. More...
 
long addColumn (const ibis::math::term *xpr, ibis::bitvector &mask, const char *cname, ibis::TYPE_T ctype=ibis::DOUBLE)
 Add a column computed with the given arithmetic expression.
 
long deactivate (const std::vector< uint32_t > &rows)
 Mark the specified rows as inactive. More...
 
long deactivate (const char *conds)
 Mark all rows satisfying the specified conditions as inactive. More...
 
long reactivate (const std::vector< uint32_t > &rows)
 Make sure the specified rows are active. More...
 
long reactivate (const char *conds)
 Make sure the rows satisfying the specified conditionis are active.
 
long purgeInactive ()
 Purge all inactive rows from the partition. More...
 
void emptyCache () const
 Empty all unused resources in cache. More...
 
void getNullMask (ibis::bitvector &m) const
 Copy the mask of active rows.
 
const ibis::bitvectorgetMaskRef () const
 Return a reference to the mask of active rows.
 
void rename (const ibis::partAssoc &known)
 Rename the partition to avoid conflicts with an existing list of data partitions. More...
 
void rename (const char *)
 Change the name of the data partition to the given name. More...
 
ibis::fileManager::ACCESS_PREFERENCE accessHint (const ibis::bitvector &mask, unsigned elemsize=4) const
 Evaluate the strategy for accessing a data file.
 
void queryTest (const char *pref, long *nerrors) const
 Generate and run random queries for slefTest. More...
 
void quickTest (const char *pref, long *nerrors) const
 Generate and run random queries for slefTest. More...
 
void testRangeOperators (const ibis::column *col, long *nerrors) const
 Try a set of range conditions with different combinations of operators. More...
 
void doBackup ()
 The routine to perform the actual copying for making a backup copy.
 
int gainReadAccess () const
 Attempt to gain a read access to this part object. More...
 
int releaseAccess () const
 Attempt to release a read or write access to this part object. More...
 
int gainWriteAccess () const
 Attempt to gain a write access to this part object. More...
 
int tryWriteAccess () const
 A soft attempt to gain a write access to this part object. More...
 

Static Public Member Functions

static void copyValue (ibis::TYPE_T type, void *outbuf, size_t outpos, const void *inbuf, size_t inpos)
 Copy a single value from inbuf to outbuf. More...
 
static ibis::bordgroupbya (const ibis::bord &, const ibis::selectClause &)
 Perform the aggregation operations specified in the select clause. More...
 
static ibis::bordgroupbyc (const ibis::bord &, const ibis::selectClause &)
 The function to perform the final computations specified by the select clause. More...
 
- Static Public Member Functions inherited from ibis::table
static void * allocateBuffer (ibis::TYPE_T, size_t)
 Allocate a buffer of the specified type and size.
 
static int64_t computeHits (const ibis::constPartList &parts, const char *cond)
 Compute the number of rows satisfying the specified conditions. More...
 
static int64_t computeHits (const ibis::constPartList &parts, const ibis::qExpr *cond)
 Compute the number of rows satisfying the specified query expression. More...
 
static void consecrateName (char *)
 Remove unallowed characters from the given string to produce a valid column name. More...
 
static ibis::tablecreate (ibis::part &)
 Create a simple of container of a partition. More...
 
static ibis::tablecreate (const ibis::partList &)
 Create a container of externally managed data partitions. More...
 
static ibis::tablecreate (const char *dir)
 Create a table object from the specified data directory. More...
 
static ibis::tablecreate (const char *dir1, const char *dir2)
 Create a table object from a pair of data directories. More...
 
static void freeBuffer (void *buffer, ibis::TYPE_T type)
 Freeing a buffer for storing in-memory values. More...
 
static void freeBuffers (bufferArray &, typeArray &)
 Freeing a list of buffers. More...
 
static bool isValidName (const char *)
 Is the given string a valid FastBit name for a data column?
 
static void parseNames (char *in, stringVector &out)
 Parse the incoming string into a set of names. More...
 
static void parseNames (char *in, stringArray &out)
 Parse the incoming string into a set of names. More...
 
static void parseOrderby (char *in, stringArray &out, std::vector< bool > &direc)
 Parse the incoming string as an order-by clause. More...
 
static tableselect (const ibis::constPartList &parts, const char *sel, const char *cond)
 Perform the select operation on a list of data partitions. More...
 
static tableselect (const ibis::constPartList &parts, const char *sel, const ibis::qExpr *cond)
 Perform select operation using a user-supplied query expression. More...
 
- Static Public Member Functions inherited from ibis::part
template<typename E >
static long doScan (const array_t< E > &varr, const ibis::qRange &cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 Locate the records that satisfy the range condition. More...
 
template<typename E >
static long doScan (const array_t< E > &varr, const ibis::qContinuousRange &cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 
template<typename E >
static long doScan (const array_t< E > &varr, const ibis::qContinuousRange &cmp, const ibis::bitvector &mask, array_t< E > &res)
 
template<typename E >
static long doScan (const array_t< E > &varr, const ibis::qContinuousRange &cmp, const ibis::bitvector &mask, array_t< E > &res, ibis::bitvector &hits)
 
static const char * skipPrefix (const char *)
 Skip pass all the dots in the given string. More...
 
static char * readMetaTags (const char *const dir)
 A class function to read the meta tags in the tdc file. More...
 
static void genName (const std::vector< const char * > &mtags, std::string &name)
 Generate name for a partition based on the meta tags.
 
static void genName (const ibis::resource::vList &mtags, std::string &name)
 Generate name for a partition based on the meta tags.
 
static uint32_t countPages (const ibis::bitvector &mask, unsigned elemsize=4)
 Estimate the number of pages to be accessed. More...
 
template<typename T >
static int writeColumn (int fdes, ibis::bitvector::word_t nold, ibis::bitvector::word_t nnew, ibis::bitvector::word_t voffset, const array_t< T > &vals, const T &fill, ibis::bitvector &totmask, const ibis::bitvector &newmask)
 Write the content of vals to an open file. More...
 
static int writeStrings (const char *fnm, ibis::bitvector::word_t nold, ibis::bitvector::word_t nnew, ibis::bitvector::word_t voffset, const std::vector< std::string > &vals, ibis::bitvector &totmask, const ibis::bitvector &newmask)
 Write strings to an open file. More...
 
static int writeRaw (int bdes, int sdes, ibis::bitvector::word_t nold, ibis::bitvector::word_t nnew, ibis::bitvector::word_t voffset, const ibis::array_t< unsigned char > &bytes, const ibis::array_t< int64_t > &starts, ibis::bitvector &totmask, const ibis::bitvector &newmask)
 Write raw bytes to an open file. More...
 
static int writeOpaques (int bdes, int sdes, ibis::bitvector::word_t nold, ibis::bitvector::word_t nnew, ibis::bitvector::word_t voffset, const std::vector< ibis::opaque > &opq, ibis::bitvector &totmask, const ibis::bitvector &newmask)
 Write raw bytes to an open file. More...
 

Protected Member Functions

 bord ()
 Default constructor. Creates a empty unnamed data partition.
 
void clear ()
 Clear the existing content.
 
int64_t computeHits (const char *cond) const
 Compute the number of hits.
 
- Protected Member Functions inherited from ibis::table
 table ()
 !< Description of the table. More...
 
 table (const char *na, const char *de)
 Constructor. Use the user-supplied name and description.
 
- Protected Member Functions inherited from ibis::part
long append1 (const char *dir)
 Perform append operation using only only one data directory. More...
 
long append2 (const char *dir)
 Perform append operation with two data directories. More...
 
long appendToBackup (const char *dir)
 Append data in dir to the partition in the backup directory. More...
 
void buildQueryList (ibis::part::thrArg &lst, unsigned nc, unsigned nq) const
 Generate a list of random query conditions. More...
 
void checkQueryList (const ibis::part::thrArg &lst) const
 Sum up the hits from sub-divisions to verify the hits computing from the whole range. More...
 
int coarsenBins (const ibis::column &col, uint32_t nbin, std::vector< double > &bnds, std::vector< ibis::bitvector * > &btmp) const
 Produce a set of bitmaps corresponding to a set of coarse bins. More...
 
void composeQueryString (std::string &str, const ibis::column *col1, const ibis::column *col2, const double &lower1, const double &upper1, const double &lower2, const double &upper2) const
 
template<typename T1 , typename T2 >
long count2DBins (array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, std::vector< uint32_t > &counts) const
 Count the number of values in 2D bins.
 
template<typename T1 , typename T2 >
long count2DWeights (array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, array_t< double > &wts, std::vector< double > &weights) const
 Count the weights in 2D bins.
 
template<typename T1 , typename T2 , typename T3 >
long count3DBins (const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const array_t< T3 > &vals3, const double &begin3, const double &end3, const double &stride3, std::vector< uint32_t > &counts) const
 Count the number of values in 3D bins.
 
template<typename T1 , typename T2 , typename T3 >
long count3DWeights (const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const array_t< T3 > &vals3, const double &begin3, const double &end3, const double &stride3, const array_t< double > &wts, std::vector< double > &weights) const
 Count the weights in 3D bins.
 
long deactivate (const ibis::bitvector &rows)
 Rows marked 1 will become inactive. More...
 
void deriveBackupDirName ()
 
void digestMeshShape (const char *shape)
 Convert the string describing the shape into internal storage format. More...
 
template<typename T >
long doCount (const ibis::qRange &cmp) const
 Count the number rows satisfying the range expression.
 
template<typename T >
long doCount (const array_t< T > &vals, const ibis::qIntHod &cmp, const ibis::bitvector &mask) const
 Count the number rows satisfying the range expression. More...
 
template<typename T >
long doCount (const array_t< T > &vals, const ibis::qUIntHod &cmp, const ibis::bitvector &mask) const
 Count the number rows satisfying the range expression. More...
 
template<typename T >
long doCount (const array_t< T > &vals, const ibis::qRange &cmp, const ibis::bitvector &mask) const
 Count the number rows satisfying the range expression. More...
 
template<typename T , typename F >
long doCount (const array_t< T > &vals, const ibis::bitvector &mask, F cmp) const
 Count the number rows satisfying the range expression.
 
template<typename T , typename F1 , typename F2 >
long doCount (const array_t< T > &vals, const ibis::bitvector &mask, F1 cmp1, F2 cmp2) const
 Count the number rows satisfying the range expression.
 
template<>
long doCount (const ibis::qRange &) const
 
template<>
long doCount (const ibis::qRange &) const
 
template<>
long doCount (const ibis::qRange &cmp) const
 A specialization of template part::doCount for float values. More...
 
template<>
long doCount (const ibis::qRange &cmp) const
 A specialization of template part::doCount for double values.
 
void extendMetaTags ()
 !< Remove the rids list from memory.
 
template<typename T1 >
long fill1DBins (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, std::vector< ibis::bitvector > &bins) const
 Fill the bitvectors representing the 1D bins. More...
 
template<typename T1 >
long fill1DBins (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, std::vector< ibis::bitvector * > &bins) const
 Fill the bitvectors representing the 1D bins. More...
 
template<typename T1 >
long fill1DBinsWeighted (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< double > &wts, std::vector< double > &weights, std::vector< ibis::bitvector * > &bins) const
 Fill the bitvectors representing the 1D bins. More...
 
template<typename T1 , typename T2 >
long fill2DBins (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, std::vector< ibis::bitvector > &bins) const
 Fill the bitvectors representing the 2D bins. More...
 
template<typename T1 , typename T2 >
long fill2DBins (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, std::vector< ibis::bitvector * > &bins) const
 Fill the bitvectors representing the 2D bins. More...
 
template<typename T1 >
long fill2DBins2 (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const ibis::column &col2, const double &begin2, const double &end2, const double &stride2, std::vector< ibis::bitvector > &bins) const
 A template function to resolve the second variable involved in the 2D bins. More...
 
template<typename T1 >
long fill2DBins2 (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const ibis::column &col2, const double &begin2, const double &end2, const double &stride2, std::vector< ibis::bitvector * > &bins) const
 This version returns a vector of pointers to bitmaps. More...
 
template<typename T1 , typename T2 >
long fill2DBinsWeighted (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const array_t< double > &wts, std::vector< double > &weights, std::vector< ibis::bitvector * > &bins) const
 Fill the bitvectors representing the 2D bins. More...
 
template<typename T1 >
long fill2DBinsWeighted2 (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const ibis::column &col2, const double &begin2, const double &end2, const double &stride2, const array_t< double > &wts, std::vector< double > &weights, std::vector< ibis::bitvector * > &bins) const
 This version returns a vector of pointers to bitmaps. More...
 
template<typename T1 , typename T2 , typename T3 >
long fill3DBins (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const array_t< T3 > &vals3, const double &begin3, const double &end3, const double &stride3, std::vector< ibis::bitvector > &bins) const
 Fill the bitvectors representing the 3D bins. More...
 
template<typename T1 , typename T2 , typename T3 >
long fill3DBins (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const array_t< T3 > &vals3, const double &begin3, const double &end3, const double &stride3, std::vector< bitvector * > &bins) const
 The three triplets, (begin1, end1, stride1), (begin2, end2, stride2), and (begin3, end3, stride3), defines (1 + floor((end1 - begin1) / stride1)) (1 + floor((end2 - begin2) / stride2)) (1 + floor((end3 - begin3) / stride3)) 3D bins. More...
 
template<typename T1 >
long fill3DBins2 (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const ibis::column &col2, const double &begin2, const double &end2, const double &stride2, const ibis::column &col3, const double &begin3, const double &end3, const double &stride3, std::vector< bitvector > &bins) const
 Resolve the 2nd column of the 3D bins. More...
 
template<typename T1 >
long fill3DBins2 (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const ibis::column &col2, const double &begin2, const double &end2, const double &stride2, const ibis::column &col3, const double &begin3, const double &end3, const double &stride3, std::vector< ibis::bitvector * > &bins) const
 Resolve the 2nd column of the 3D bins. More...
 
template<typename T1 , typename T2 >
long fill3DBins3 (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const ibis::column &col3, const double &begin3, const double &end3, const double &stride3, std::vector< bitvector > &bins) const
 Resolve the 3rd column involved in the 3D bins. More...
 
template<typename T1 , typename T2 >
long fill3DBins3 (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const ibis::column &col3, const double &begin3, const double &end3, const double &stride3, std::vector< ibis::bitvector * > &bins) const
 Resolve the 3rd column involved in the 3D bins. More...
 
template<typename T1 , typename T2 , typename T3 >
long fill3DBinsWeighted (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const array_t< T3 > &vals3, const double &begin3, const double &end3, const double &stride3, const array_t< double > &wts, std::vector< double > &weights, std::vector< bitvector * > &bins) const
 The three triplets, (begin1, end1, stride1), (begin2, end2, stride2), and (begin3, end3, stride3), defines (1 + floor((end1 - begin1) / stride1)) (1 + floor((end2 - begin2) / stride2)) (1 + floor((end3 - begin3) / stride3)) 3D bins. More...
 
template<typename T1 >
long fill3DBinsWeighted2 (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const ibis::column &col2, const double &begin2, const double &end2, const double &stride2, const ibis::column &col3, const double &begin3, const double &end3, const double &stride3, const array_t< double > &wts, std::vector< double > &weights, std::vector< ibis::bitvector * > &bins) const
 Resolve the 2nd column of the 3D bins. More...
 
template<typename T1 , typename T2 >
long fill3DBinsWeighted3 (const ibis::bitvector &mask, const array_t< T1 > &vals1, const double &begin1, const double &end1, const double &stride1, const array_t< T2 > &vals2, const double &begin2, const double &end2, const double &stride2, const ibis::column &col3, const double &begin3, const double &end3, const double &stride3, const array_t< double > &wts, std::vector< double > &weights, std::vector< ibis::bitvector * > &bins) const
 Resolve the 3rd column involved in the 3D bins. More...
 
void freeRIDs () const
 !< Read RIDs from file 'rids'. More...
 
void gatherSortKeys (ibis::table::stringArray &names)
 Collect a list of column names that might be used as keys for sorting the rows. More...
 
long get1DBins_ (const ibis::bitvector &mask, const ibis::column &col, uint32_t nbin, std::vector< double > &bounds, std::vector< ibis::bitvector > &bins, const char *mesg) const
 Compute 1D histogram from raw data. More...
 
long get1DDistribution (const ibis::column &col, uint32_t nbin, std::vector< double > &bounds, std::vector< uint32_t > &counts) const
 Compute 1D histogram from index. More...
 
long get2DDistributionA (const ibis::column &col1, const ibis::column &col2, uint32_t nb1, uint32_t nb2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< uint32_t > &counts) const
 Compute 2D histogram with adaptive bins from base data. More...
 
long get2DDistributionI (const ibis::column &col1, const ibis::column &col2, uint32_t nb1, uint32_t nb2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< uint32_t > &counts) const
 Compute 2D histogram from indexes.
 
long get2DDistributionU (const ibis::column &col1, const ibis::column &col2, uint32_t nb1, uint32_t nb2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< uint32_t > &counts) const
 Compute 2D histogram with uniform bins from base data. More...
 
long get3DDistributionA (const ibis::bitvector &mask, const ibis::column &col1, const ibis::column &col2, const ibis::column &col3, uint32_t nb1, uint32_t nb2, uint32_t nb3, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< double > &bounds3, std::vector< uint32_t > &counts) const
 Compute 3D histogram with adaptive bins from base data. More...
 
template<typename E1 >
long get3DDistributionA1 (const ibis::bitvector &mask, const array_t< E1 > &vals1, const ibis::column &col2, const ibis::column &col3, uint32_t nb1, uint32_t nb2, uint32_t nb3, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< double > &bounds3, std::vector< uint32_t > &counts) const
 Read the value of the second column. More...
 
template<typename E1 , typename E2 >
long get3DDistributionA2 (const ibis::bitvector &mask, const array_t< E1 > &vals1, const array_t< E2 > &vals2, const ibis::column &col3, uint32_t nb1, uint32_t nb2, uint32_t nb3, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< double > &bounds3, std::vector< uint32_t > &counts) const
 Read the values of the third column. More...
 
void logError (const char *event, const char *fmt,...) const
 Write out a message with indication of severe error.
 
void makeBackupCopy ()
 Spawn another thread to copy the content of activeDir to backupDir.
 
void numbersToBitvector (const std::vector< uint32_t > &, ibis::bitvector &) const
 Turn a list of numbers into a bitvector. More...
 
long old2DDistribution (const char *constraints, const char *name1, const char *name2, uint32_t nb1, uint32_t nb2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< uint32_t > &counts) const
 The old implementation that uses binary lookup. More...
 
long packCumulativeDistribution (const std::vector< double > &bounds, const std::vector< uint32_t > &counts, uint32_t nbc, double *bptr, uint32_t *cptr) const
 Pack a cumulative distribution stored in two std::vectors into two arrays provided by the caller. More...
 
long packDistribution (const std::vector< double > &bounds, const std::vector< uint32_t > &counts, uint32_t nbc, double *bptr, uint32_t *cptr) const
 Pack a binned distribution.
 
long reactivate (const ibis::bitvector &rows)
 Change all rows marked 1 to be active. More...
 
void readMeshShape (const char *const dir)
 Read shape of the mesh from the metadata file.
 
int readMetaData (uint32_t &nrows, columnList &plist, const char *dir)
 !< Don't change the data. More...
 
void readRIDs () const
 A function to retrieve RIDs stored in file.
 
uint32_t recursiveQuery (const char *pref, const column *att, double low, double high, long *nerr) const
 Issues a query and then subdivided the range into three to check the total hits of the three sub queries matches the hits of the single query. More...
 
template<typename T >
long reorderValues (const char *fname, array_t< uint32_t > &starts, array_t< uint32_t > &indout, const array_t< uint32_t > &indin, bool ascending)
 Write the named data file in a segmented sorted order. More...
 
void setMetaTags (const ibis::resource::vList &mts)
 Make a deep copy of the incoming name-value pairs.
 
void setMetaTags (const std::vector< const char * > &mts)
 Make a deep copy of the incoming name-value pairs. More...
 
void stringToBitvector (const char *, ibis::bitvector &) const
 Convert a set of range conditions to an ibis::bitvector. More...
 
long verifyBackupDir ()
 
void writeMetaData (const uint32_t nrows, const columnList &plist, const char *dir) const
 Write metadata file -part.txt. More...
 
template<typename T >
long writeValues (const char *fname, const array_t< uint32_t > &ind)
 Write the named data file with values in the given order. More...
 

Static Protected Member Functions

static int merge0 (std::vector< ibis::bord::column * > &, const std::vector< ibis::bord::column * > &, const std::vector< ibis::selectClause::AGREGADO > &)
 Merge values according to the given operators. More...
 
template<typename T >
static int merge0T (ibis::array_t< T > &, const ibis::array_t< T > &, ibis::selectClause::AGREGADO)
 Template function to perform the merger operations on arrays with matching keys. More...
 
static int merge10 (ibis::bord::column &, std::vector< ibis::bord::column * > &, const ibis::bord::column &, const std::vector< ibis::bord::column * > &, const std::vector< ibis::selectClause::AGREGADO > &)
 Merge with one key column and an arbitrary number of value columns.
 
static int merge10S (std::vector< std::string > &kout, std::vector< ibis::bord::column * > &vout, const std::vector< std::string > &kin1, const std::vector< ibis::bord::column * > &vin1, const std::vector< std::string > &kin2, const std::vector< ibis::bord::column * > &vin2, const std::vector< ibis::selectClause::AGREGADO > &agg)
 
template<typename Tk >
static int merge10T (ibis::array_t< Tk > &kout, std::vector< ibis::bord::column * > &vout, const ibis::array_t< Tk > &kin1, const std::vector< ibis::bord::column * > &vin1, const ibis::array_t< Tk > &kin2, const std::vector< ibis::bord::column * > &vin2, const std::vector< ibis::selectClause::AGREGADO > &agg)
 Perform merge operation with one key column and an arbitrary number of value columns. More...
 
static int merge11 (ibis::bord::column &, ibis::bord::column &, const ibis::bord::column &, const ibis::bord::column &, ibis::selectClause::AGREGADO)
 Function to merge one column as key and one column as value.
 
template<typename Tv >
static int merge11S (std::vector< std::string > &kout, ibis::array_t< Tv > &vout, const std::vector< std::string > &kin1, const ibis::array_t< Tv > &vin1, const std::vector< std::string > &kin2, const ibis::array_t< Tv > &vin2, ibis::selectClause::AGREGADO agg)
 
template<typename Tk , typename Tv >
static int merge11T (ibis::array_t< Tk > &kout, ibis::array_t< Tv > &vout, const ibis::array_t< Tk > &kin1, const ibis::array_t< Tv > &vin1, const ibis::array_t< Tk > &kin2, const ibis::array_t< Tv > &vin2, ibis::selectClause::AGREGADO agg)
 Template to perform merge operation with one column as key and one column as value. More...
 
static int merge12 (ibis::bord::column &, ibis::bord::column &, ibis::bord::column &, const ibis::bord::column &, const ibis::bord::column &, const ibis::bord::column &, ibis::selectClause::AGREGADO, ibis::selectClause::AGREGADO)
 Merge two aggregations sharing the same key.
 
template<typename Tu , typename Tv >
static int merge12S (std::vector< std::string > &kout, ibis::array_t< Tu > &uout, ibis::array_t< Tv > &vout, const std::vector< std::string > &kin1, const ibis::array_t< Tu > &uin1, const ibis::array_t< Tv > &vin1, const std::vector< std::string > &kin2, const ibis::array_t< Tu > &uin2, const ibis::array_t< Tv > &vin2, ibis::selectClause::AGREGADO au, ibis::selectClause::AGREGADO av)
 
static int merge12S1 (std::vector< std::string > &kout, const std::vector< std::string > &kin1, const std::vector< std::string > &kin2, ibis::bord::column &, ibis::bord::column &, const ibis::bord::column &, const ibis::bord::column &, ibis::selectClause::AGREGADO, ibis::selectClause::AGREGADO)
 
template<typename Tk , typename Tu , typename Tv >
static int merge12T (ibis::array_t< Tk > &kout, ibis::array_t< Tu > &uout, ibis::array_t< Tv > &vout, const ibis::array_t< Tk > &kin1, const ibis::array_t< Tu > &uin1, const ibis::array_t< Tv > &vin1, const ibis::array_t< Tk > &kin2, const ibis::array_t< Tu > &uin2, const ibis::array_t< Tv > &vin2, ibis::selectClause::AGREGADO au, ibis::selectClause::AGREGADO av)
 
template<typename Tk >
static int merge12T1 (ibis::array_t< Tk > &kout, const ibis::array_t< Tk > &kin1, const ibis::array_t< Tk > &kin2, ibis::bord::column &, ibis::bord::column &, const ibis::bord::column &, const ibis::bord::column &, ibis::selectClause::AGREGADO, ibis::selectClause::AGREGADO)
 
static int merge20 (ibis::bord::column &k11, ibis::bord::column &k21, std::vector< ibis::bord::column * > &v1, const ibis::bord::column &k12, const ibis::bord::column &k22, const std::vector< ibis::bord::column * > &v2, const std::vector< ibis::selectClause::AGREGADO > &agg)
 Merge with two key columns and arbitrary number of value columns.
 
static int merge20S0 (std::vector< std::string > &k1out, std::vector< std::string > &k2out, std::vector< ibis::bord::column * > &vout, const std::vector< std::string > &k1in1, const std::vector< std::string > &k2in1, const std::vector< ibis::bord::column * > &vin1, const std::vector< std::string > &k1in2, const std::vector< std::string > &k2in2, const std::vector< ibis::bord::column * > &vin2, const std::vector< ibis::selectClause::AGREGADO > &agg)
 
static int merge20S1 (std::vector< std::string > &k1out, const std::vector< std::string > &k1in1, const std::vector< std::string > &k1in2, ibis::bord::column &k21, std::vector< ibis::bord::column * > &vin1, const ibis::bord::column &k22, const std::vector< ibis::bord::column * > &vin2, const std::vector< ibis::selectClause::AGREGADO > &agg)
 
template<typename Tk2 >
static int merge20S2 (std::vector< std::string > &k1out, ibis::array_t< Tk2 > &k2out, std::vector< ibis::bord::column * > &vout, const std::vector< std::string > &k1in1, const ibis::array_t< Tk2 > &k2in1, const std::vector< ibis::bord::column * > &vin1, const std::vector< std::string > &k1in2, const ibis::array_t< Tk2 > &k2in2, const std::vector< ibis::bord::column * > &vin2, const std::vector< ibis::selectClause::AGREGADO > &agg)
 
template<typename Tk1 >
static int merge20S3 (ibis::array_t< Tk1 > &k1out, std::vector< std::string > &k2out, std::vector< ibis::bord::column * > &vout, const ibis::array_t< Tk1 > &k1in1, const std::vector< std::string > &k2in1, const std::vector< ibis::bord::column * > &vin1, const ibis::array_t< Tk1 > &k1in2, const std::vector< std::string > &k2in2, const std::vector< ibis::bord::column * > &vin2, const std::vector< ibis::selectClause::AGREGADO > &agg)
 
template<typename Tk1 >
static int merge20T1 (ibis::array_t< Tk1 > &k1out, const ibis::array_t< Tk1 > &k1in1, const ibis::array_t< Tk1 > &k1in2, ibis::bord::column &k21, std::vector< ibis::bord::column * > &vin1, const ibis::bord::column &k22, const std::vector< ibis::bord::column * > &vin2, const std::vector< ibis::selectClause::AGREGADO > &agg)
 Merge with two key columns and arbitrary number of value columns. More...
 
template<typename Tk1 , typename Tk2 >
static int merge20T2 (ibis::array_t< Tk1 > &k1out, ibis::array_t< Tk2 > &k2out, std::vector< ibis::bord::column * > &vout, const ibis::array_t< Tk1 > &k1in1, const ibis::array_t< Tk2 > &k2in1, const std::vector< ibis::bord::column * > &vin1, const ibis::array_t< Tk1 > &k1in2, const ibis::array_t< Tk2 > &k2in2, const std::vector< ibis::bord::column * > &vin2, const std::vector< ibis::selectClause::AGREGADO > &agg)
 Merge in-memory table with two keys and more than one value columns. More...
 
static int merge21 (ibis::bord::column &k11, ibis::bord::column &k21, ibis::bord::column &v1, const ibis::bord::column &k12, const ibis::bord::column &k22, const ibis::bord::column &v2, ibis::selectClause::AGREGADO ag)
 Merge two key columns with one value column.
 
static int merge21S1 (std::vector< std::string > &k1out, const std::vector< std::string > &k1in1, const std::vector< std::string > &k1in2, ibis::bord::column &k21, ibis::bord::column &v1, const ibis::bord::column &k22, const ibis::bord::column &v2, ibis::selectClause::AGREGADO ag)
 
template<typename Tk2 >
static int merge21S2 (std::vector< std::string > &k1out, ibis::array_t< Tk2 > &k2out, const std::vector< std::string > &k1in1, const ibis::array_t< Tk2 > &k2in1, const std::vector< std::string > &k1in2, const ibis::array_t< Tk2 > &k2in2, ibis::bord::column &v1, const ibis::bord::column &v2, ibis::selectClause::AGREGADO ag)
 
template<typename Tk2 , typename Tv >
static int merge21S3 (std::vector< std::string > &k1out, ibis::array_t< Tk2 > &k2out, ibis::array_t< Tv > &vout, const std::vector< std::string > &k1in1, const ibis::array_t< Tk2 > &k2in1, const ibis::array_t< Tv > &vin1, const std::vector< std::string > &k1in2, const ibis::array_t< Tk2 > &k2in2, const ibis::array_t< Tv > &vin2, ibis::selectClause::AGREGADO av)
 
static int merge21S4 (std::vector< std::string > &k1out, std::vector< std::string > &k2out, const std::vector< std::string > &k1in1, const std::vector< std::string > &k2in1, const std::vector< std::string > &k1in2, const std::vector< std::string > &k2in2, ibis::bord::column &v1, const ibis::bord::column &v2, ibis::selectClause::AGREGADO ag)
 
template<typename Tv >
static int merge21S5 (std::vector< std::string > &k1out, std::vector< std::string > &k2out, ibis::array_t< Tv > &vout, const std::vector< std::string > &k1in1, const std::vector< std::string > &k2in1, const ibis::array_t< Tv > &vin1, const std::vector< std::string > &k1in2, const std::vector< std::string > &k2in2, const ibis::array_t< Tv > &vin2, ibis::selectClause::AGREGADO av)
 
template<typename Tk1 >
static int merge21S6 (ibis::array_t< Tk1 > &k1out, std::vector< std::string > &k2out, const ibis::array_t< Tk1 > &k1in1, const std::vector< std::string > &k2in1, const ibis::array_t< Tk1 > &k1in2, const std::vector< std::string > &k2in2, ibis::bord::column &v1, const ibis::bord::column &v2, ibis::selectClause::AGREGADO ag)
 
template<typename Tk1 , typename Tv >
static int merge21S7 (ibis::array_t< Tk1 > &k1out, std::vector< std::string > &k2out, ibis::array_t< Tv > &vout, const ibis::array_t< Tk1 > &k1in1, const std::vector< std::string > &k2in1, const ibis::array_t< Tv > &vin1, const ibis::array_t< Tk1 > &k1in2, const std::vector< std::string > &k2in2, const ibis::array_t< Tv > &vin2, ibis::selectClause::AGREGADO av)
 
template<typename Tk1 >
static int merge21T1 (ibis::array_t< Tk1 > &k1out, const ibis::array_t< Tk1 > &k1in1, const ibis::array_t< Tk1 > &k1in2, ibis::bord::column &k21, ibis::bord::column &v1, const ibis::bord::column &k22, const ibis::bord::column &v2, ibis::selectClause::AGREGADO ag)
 Merge two key columns with one value column. More...
 
template<typename Tk1 , typename Tk2 >
static int merge21T2 (ibis::array_t< Tk1 > &k1out, ibis::array_t< Tk2 > &k2out, const ibis::array_t< Tk1 > &k1in1, const ibis::array_t< Tk2 > &k2in1, const ibis::array_t< Tk1 > &k1in2, const ibis::array_t< Tk2 > &k2in2, ibis::bord::column &v1, const ibis::bord::column &v2, ibis::selectClause::AGREGADO ag)
 Merge two key columns with one value column. More...
 
template<typename Tk1 , typename Tk2 , typename Tv >
static int merge21T3 (ibis::array_t< Tk1 > &k1out, ibis::array_t< Tk2 > &k2out, ibis::array_t< Tv > &vout, const ibis::array_t< Tk1 > &k1in1, const ibis::array_t< Tk2 > &k2in1, const ibis::array_t< Tv > &vin1, const ibis::array_t< Tk1 > &k1in2, const ibis::array_t< Tk2 > &k2in2, const ibis::array_t< Tv > &vin2, ibis::selectClause::AGREGADO av)
 Merge two key columns with one value column. More...
 
static int merger (std::vector< ibis::bord::column * > &, std::vector< ibis::bord::column * > &, const std::vector< ibis::bord::column * > &, const std::vector< ibis::bord::column * > &, const std::vector< ibis::selectClause::AGREGADO > &)
 Merge values from two partial results and place the final resules in the first argument. More...
 
- Static Protected Member Functions inherited from ibis::part
template<typename T1 , typename T2 >
static long adaptive2DBins (const array_t< T1 > &vals1, const array_t< T2 > &vals2, uint32_t nb1, uint32_t nb2, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< uint32_t > &counts)
 Adaptive binning through regularly spaced bins. More...
 
template<typename T1 , typename T2 , typename T3 >
static long adaptive3DBins (const array_t< T1 > &vals1, const array_t< T2 > &vals2, const array_t< T3 > &vals3, uint32_t nb1, uint32_t nb2, uint32_t nb3, std::vector< double > &bounds1, std::vector< double > &bounds2, std::vector< double > &bounds3, std::vector< uint32_t > &counts)
 Adaptive binning through regularly spaced bins. More...
 
template<typename T >
static long adaptiveFloats (const array_t< T > &vals, const T vmin, const T vmax, uint32_t nbins, std::vector< double > &bounds, std::vector< uint32_t > &counts)
 The adaptive binning function for floats and integers in wide ranges. More...
 
template<typename T >
static long adaptiveFloatsDetailed (const ibis::bitvector &mask, const array_t< T > &vals, const T vmin, const T vmax, uint32_t nbins, std::vector< double > &bounds, std::vector< ibis::bitvector > &detail)
 Bins the given values so that each each bin is nearly equal weight. More...
 
template<typename T >
static long adaptiveInts (const array_t< T > &vals, const T vmin, const T vmax, uint32_t nbins, std::vector< double > &bounds, std::vector< uint32_t > &counts)
 The adaptive binning function for integer values. More...
 
template<typename T >
static long adaptiveIntsDetailed (const ibis::bitvector &mask, const array_t< T > &vals, const T vmin, const T vmax, uint32_t nbins, std::vector< double > &bounds, std::vector< ibis::bitvector > &detail)
 Bins the given values so that each each bin is nearly equal weight. More...
 
template<typename T , typename F >
static long doComp (const array_t< T > &vals, F cmp, const ibis::bitvector &mask, array_t< T > &res, ibis::bitvector &hits)
 Evaluate the range condition. More...
 
template<typename T , typename F >
static long doComp (const array_t< T > &vals, F cmp, const ibis::bitvector &mask, array_t< T > &res)
 Evaluate the range condition. More...
 
template<typename T , typename F >
static long doComp (const array_t< T > &vals, F cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 Evaluate the range condition. More...
 
template<typename T , typename F1 , typename F2 >
static long doComp (const array_t< T > &vals, F1 cmp1, F2 cmp2, const ibis::bitvector &mask, array_t< T > &res, ibis::bitvector &hits)
 Evaluate the range condition. More...
 
template<typename T , typename F1 , typename F2 >
static long doComp (const array_t< T > &vals, F1 cmp1, F2 cmp2, const ibis::bitvector &mask, array_t< T > &res)
 Evaluate the range condition. More...
 
template<typename T , typename F1 , typename F2 >
static long doComp (const array_t< T > &vals, F1 cmp1, F2 cmp2, const ibis::bitvector &mask, ibis::bitvector &hits)
 Evaluate the range condition. More...
 
template<typename T , typename F >
static long doComp0 (const array_t< T > &vals, F cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 Evaluate the range condition. More...
 
template<typename T , typename F1 , typename F2 >
static long doComp0 (const array_t< T > &vals, F1 cmp1, F2 cmp2, const ibis::bitvector &mask, ibis::bitvector &hits)
 This version uses uncompressed bitvector to store the scan results internally. More...
 
template<typename T >
static long doCompare (const array_t< T > &array, const ibis::qRange &cmp, const ibis::bitvector &mask, ibis::array_t< T > &res, ibis::bitvector &hits)
 The function that performs the actual comparison for range queries. More...
 
template<typename T >
static long doCompare (const char *file, const ibis::qRange &cmp, const ibis::bitvector &mask, ibis::array_t< T > &res, ibis::bitvector &hits)
 Perform comparisons with data in the named file. More...
 
template<typename T >
static long doCompare (const array_t< T > &array, const ibis::qRange &cmp, const ibis::bitvector &mask, ibis::array_t< T > &res)
 The function that performs the actual comparison for range queries. More...
 
template<typename T >
static long doCompare (const char *file, const ibis::qRange &cmp, const ibis::bitvector &mask, ibis::array_t< T > &res)
 Perform comparisons with data in the named file. More...
 
template<typename T >
static long doCompare (const array_t< T > &array, const ibis::qRange &cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 The function that performs the actual comparison for range queries. More...
 
template<typename T >
static long doCompare (const char *file, const ibis::qRange &cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 Perform comparisons with data in the named file. More...
 
template<typename T >
static long doCompare (const array_t< T > &array, const ibis::qIntHod &cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 The function that performs the actual comparison for range queries. More...
 
template<typename T >
static long doCompare (const char *file, const ibis::qIntHod &cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 Evaluate the range condition. More...
 
template<typename T >
static long doCompare (const array_t< T > &array, const ibis::qUIntHod &cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 The function that performs the actual comparison for range queries. More...
 
template<typename T >
static long doCompare (const char *file, const ibis::qUIntHod &cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 
template<typename T >
static void equalWeightBins (const array_t< T > &vals, uint32_t nbins, array_t< T > &bounds)
 
template<typename E1 , typename E2 >
static void mapValues (array_t< E1 > &val1, array_t< E2 > &val2, uint32_t nb1, uint32_t nb2, array_t< E1 > &bnd1, array_t< E2 > &bnd2, std::vector< uint32_t > &cnts)
 The templated function to decide the bin boundaries and count the number of values fall in each bin. More...
 
template<typename T >
static void mapValues (const array_t< T > &vals, std::map< T, uint32_t > &hist)
 
template<typename T >
static long negativeCompare (const array_t< T > &array, const ibis::qRange &cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 
template<typename T >
static long negativeCompare (const char *file, const ibis::qRange &cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 
template<typename T >
static long negativeCompare (const array_t< T > &array, const ibis::qIntHod &cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 Perform the negative comparison. More...
 
template<typename T >
static long negativeCompare (const char *file, const ibis::qIntHod &cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 Perform the negative comparison. More...
 
template<typename T >
static long negativeCompare (const array_t< T > &array, const ibis::qUIntHod &cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 
template<typename T >
static long negativeCompare (const char *file, const ibis::qUIntHod &cmp, const ibis::bitvector &mask, ibis::bitvector &hits)
 
static int reorderBitmap (ibis::bitvector &, const ibis::bitvector &, const ibis::array_t< uint32_t > &)
 Produce a reordered bit vector through the inverse order array.
 

Friends

class cursor
 

Additional Inherited Members

- Public Types inherited from ibis::table
typedef ibis::array_t< void * > bufferArray
 A list to hold the in-memory buffers. More...
 
typedef std::map< const char *, ibis::TYPE_T, ibis::lessi > namesTypes
 An associative array of names and types.
 
typedef ibis::array_t< const char * > stringArray
 A list of strings. More...
 
typedef std::vector< const char * > stringVector
 
typedef ibis::array_t< ibis::TYPE_TtypeArray
 A list of data types.
 
- Public Types inherited from ibis::part
enum  TABLE_STATE {
  UNKNOWN_STATE =0, STABLE_STATE, RECEIVING_STATE, PRETRANSITION_STATE,
  TRANSITION_STATE, POSTTRANSITION_STATE
}
 
typedef std::map< const char *, column *, lessi > columnList
 !< A function to start backing up the active dir. More...
 
- Protected Attributes inherited from ibis::table
std::string desc_
 !< Name of the table.
 
std::string name_
 
- Protected Attributes inherited from ibis::part
char * activeDir
 !< Number of events (rows) in the partition.
 
ibis::bitvector amask
 !< Index specification.
 
char * backupDir
 !< The active data directory.
 
std::vector< const column * > colorder
 !< Active rows are maked 1.
 
columnList columns
 !< The object IDs (row id).
 
char * idxstr
 
std::string m_desc
 !< Name of the data partition.
 
char * m_name
 
ibis::resource::vList metaList
 !< Free form description of the partition.
 
ibis::part::cleanermyCleaner
 !< Sizes of the dimensions.
 
uint32_t nEvents
 !< List of the columns.
 
bool readonly
 !< The cleaner for the file manager.
 
array_t< rid_t > * rids
 !< Meta tags as name-value pairs.
 
std::vector< std::string > shapeName
 !< An ordering of columns.
 
std::vector< uint32_t > shapeSize
 !< Names of the dimensions.
 
TABLE_STATE state
 !< Time of last switch operation.
 
time_t switchTime
 !< The backup data directory.
 

Detailed Description

Class ibis::bord stores all its data in memory.

The function ibis::table::select produces an ibis::bord object to store nontrivial results.

Note
Since all data records are stored in memory, the number of rows that can be stored is limited. Even when there is sufficient memory, because the number of rows is internally stored as a 32-bit integer, it can represent no more than 2 billion rows.
Bord is a Danish word for "table."

Constructor & Destructor Documentation

ibis::bord::bord ( const char *  tn,
const char *  td,
uint64_t  nr,
ibis::table::bufferArray buf,
const ibis::table::typeArray ct,
const ibis::table::stringArray cn,
const ibis::table::stringArray cdesc = 0,
const std::vector< const ibis::dictionary * > *  dct = 0 
)
ibis::bord::bord ( const char *  tn,
const char *  td,
const ibis::selectClause sc,
const ibis::part ref 
)
ibis::bord::bord ( const char *  tn,
const char *  td,
const ibis::selectClause sc,
const ibis::constPartList &  ref 
)

Constructor.

It produces an empty data partition for storing values to be selected by the select clause. The reference data partition list is used to determine the data types. For columns, the type is determined by the first data partition in the list. However, for categorical values it checks to see if all the data partitions have the same dictionary before deciding what type to use. If the data partitions have the same dictionary, then it uses an integer representation for the column, otherwise it keeps the strings explcitly. Normally, we would expect the integer reprepresentation to be more compact and more efficient to use.

Note
The list of partitions, ref, can not be empty.

References ibis::selectClause::aggExpr(), ibis::selectClause::aggName(), ibis::selectClause::aggSize(), ibis::CATEGORY, ibis::part::colorder, ibis::part::columns, ibis::table::desc_, ibis::DOUBLE, ibis::dictionary::equal_to(), ibis::category::getDictionary(), ibis::column::getDictionary(), ibis::column::loadIndex(), ibis::part::m_desc, ibis::part::name(), ibis::column::name(), ibis::util::randName(), ibis::bord::column::setDictionary(), ibis::part::skipPrefix(), ibis::part::state, ibis::util::strnewdup(), ibis::TEXT, ibis::column::type(), and ibis::UINT.

ibis::bord::bord ( const std::vector< ibis::bord::column * > &  cols,
uint32_t  nr = 0 
)

Member Function Documentation

int ibis::bord::append ( const ibis::selectClause sc,
const ibis::part prt,
const ibis::bitvector mask 
)

Append the values marked 1 to this data partition.

This is an in-memory operation and therefore can only accomodate relatively small number of rows.

It returns the number of rows added upon successful completion. Otherwise it returns a negative number to indicate error.

References ibis::bord::column::addCounts(), ibis::selectClause::aggExpr(), ibis::selectClause::aggSize(), ibis::bord::column::append(), ibis::part::calculate(), ibis::bitvector::cnt(), ibis::column::description(), ibis::part::getColumn(), ibis::selectClause::getOrdered(), ibis::part::name(), ibis::column::name(), ibis::bitvector::set(), ibis::column::setTimeFormat(), and ibis::array_t< T >::size().

Referenced by ibis::filter::sift0(), ibis::filter::sift0S(), ibis::filter::sift1(), ibis::filter::sift1S(), ibis::filter::sift2(), and ibis::filter::sift2S().

int ibis::bord::append ( const ibis::selectClause sc,
const ibis::part prt,
const ibis::qContinuousRange cnd 
)

Append the rows satisfying the specified range expression.

This function assumes the select clause only needs the column involved in the range condition to complete its operations.

It returns the number rows satisfying the range expression on success, otherwise it returns a negative value.

References ibis::bord::column::addCounts(), ibis::selectClause::aggExpr(), ibis::selectClause::aggSize(), ibis::bord::column::append(), ibis::part::calculate(), ibis::qContinuousRange::colName(), ibis::part::columns, ibis::column::description(), ibis::part::getColumn(), ibis::selectClause::getOrdered(), ibis::part::name(), ibis::column::name(), ibis::part::nEvents, ibis::bitvector::set(), ibis::column::setTimeFormat(), ibis::array_t< T >::size(), and ibis::column::type().

int ibis::bord::backup ( const char *  dir,
const char *  tname = 0,
const char *  tdesc = 0 
) const
virtual

Write the content of partition into the specified directory dir.

The directory dir must be writable. If the second and third arguments are valid, the output data will use them as the name and the description of the data partition.

Implements ibis::table.

References ibis::BLOB, ibis::CATEGORY, ibis::bitvector::cnt(), ibis::horometer::CPUTime(), ibis::part::description(), ibis::DOUBLE, ibis::part::emptyCache(), ibis::FLOAT, ibis::fileManager::flushDir(), ibis::part::getColumn(), ibis::bord::column::getDictionary(), ibis::gParameters(), ibis::part::indexSpec(), ibis::fileManager::instance(), ibis::INT, ibis::LONG, ibis::util::makeDir(), ibis::part::metaTags(), ibis::part::name(), ibis::column::name(), ibis::part::nColumns(), ibis::part::nRows(), ibis::OID, ibis::bitvector::read(), ibis::horometer::realTime(), ibis::util::secondsToString(), ibis::bord::column::selectBytes(), ibis::bord::column::selectDoubles(), ibis::bord::column::selectFloats(), ibis::bord::column::selectInts(), ibis::bord::column::selectLongs(), ibis::bord::column::selectShorts(), ibis::bord::column::selectStrings(), ibis::bord::column::selectUBytes(), ibis::bord::column::selectUInts(), ibis::bord::column::selectULongs(), ibis::bord::column::selectUShorts(), ibis::bitvector::set(), ibis::SHORT, ibis::bitvector::size(), ibis::horometer::start(), ibis::horometer::stop(), ibis::TEXT, ibis::column::type(), ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, UnixOpen, ibis::USHORT, ibis::dictionary::write(), ibis::part::writeColumn(), ibis::part::writeOpaques(), and ibis::part::writeStrings().

virtual int ibis::bord::buildIndex ( const char *  colname,
const char *  option 
)
inlinevirtual

The following functions deal with auxillary data for accelerating query processing, primarily for building indexes.

Create the index for the named column. The existing index will be replaced. If an indexing option is not specified, it will use the internally recorded option for the named column or the table containing the column.

Note
Unless there is a specific instruction to not index a column, the querying functions will automatically build indexes as necessary. However, as building an index is relatively expensive, building an index on a column is on average about four or five times as expensive as reading the column from disk, this function is provided to build indexes beforehand.

Implements ibis::table.

virtual int ibis::bord::buildIndexes ( const ibis::table::stringArray )
inlinevirtual

The following functions deal with auxillary data for accelerating query processing, primarily for building indexes.

Create the index for the named column. The existing index will be replaced. If an indexing option is not specified, it will use the internally recorded option for the named column or the table containing the column.

Note
Unless there is a specific instruction to not index a column, the querying functions will automatically build indexes as necessary. However, as building an index is relatively expensive, building an index on a column is on average about four or five times as expensive as reading the column from disk, this function is provided to build indexes beforehand.

Implements ibis::table.

virtual int ibis::bord::buildIndexes ( const char *  options)
inlinevirtual

Create indexes for every column of the table.

Existing indexes will be replaced. If an indexing option is not specified, the internally recorded options will be used.

See also
buildIndex

Implements ibis::table.

ibis::table::stringArray ibis::bord::columnNames ( ) const
virtual
Note
The pointers returned are pointing to names stored internally. The caller should not attempt to free these pointers.

Implements ibis::table.

References ibis::part::columnNames().

void ibis::bord::copyColumn ( const char *  nm,
ibis::TYPE_T t,
void *&  buf,
const ibis::dictionary *&  dic 
) const

Copy the type and values of the named column.

It uses a shallow copy for integers and floating-point numbers.

References ibis::CATEGORY, ibis::DOUBLE, ibis::FLOAT, ibis::bord::column::getDictionary(), ibis::column::getValuesArray(), ibis::INT, ibis::LONG, ibis::SHORT, ibis::TEXT, ibis::column::type(), ibis::UBYTE, ibis::UINT, ibis::ULONG, ibis::UNKNOWN_TYPE, and ibis::USHORT.

Referenced by groupbyc(), and xgroupby().

void ibis::bord::copyValue ( ibis::TYPE_T  type,
void *  outbuf,
size_t  outpos,
const void *  inbuf,
size_t  inpos 
)
inlinestatic

Copy a single value from inbuf to outbuf.

The output buffer must have the correct size on entry. This function does NOT attempt to resize the output buffer.

References ibis::BLOB, ibis::CATEGORY, ibis::DOUBLE, ibis::FLOAT, ibis::INT, ibis::LONG, ibis::SHORT, ibis::TEXT, ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

Referenced by ibis::jNatural::fillResult(), and ibis::jRange::fillResult().

void ibis::bord::describe ( std::ostream &  ) const
virtual

!< Return data types.

Print a description of the table to the specified output stream.

Implements ibis::table.

References ibis::TYPESTRING.

Referenced by merge(), ibis::filter::sift0(), ibis::filter::sift0S(), ibis::filter::sift1(), ibis::filter::sift1S(), ibis::filter::sift2(), ibis::filter::sift2S(), and xgroupby().

int ibis::bord::dump ( std::ostream &  out,
const char *  del 
) const
virtual

Print the values in ASCII form to the specified output stream.

The default delimiter is coma (","), which produces Comma-Separated-Values (CSV).

Implements ibis::table.

Referenced by bord(), merge(), and ibis::filter::sift2().

int ibis::bord::dump ( std::ostream &  out,
uint64_t  nr,
const char *  del 
) const
virtual

Print the first nr rows of the data to the given output stream.

The return values:

0 -- normal (successful) completion
-1 -- no data in-memory
-2 -- unknown data type
-3 -- some columns not ibis::bord::column (not in-memory)
-4 -- error in the output stream

Implements ibis::table.

References ibis::column::name().

int ibis::bord::dump ( std::ostream &  out,
uint64_t  offset,
uint64_t  nr,
const char *  del 
) const
virtual

Print nr rows starting with row offset.

Note that the row number starts with 0, i.e., the first row is row 0.

Implements ibis::table.

References ibis::column::name().

void ibis::bord::estimate ( const char *  cond,
uint64_t &  nmin,
uint64_t &  nmax 
) const
virtual

Estimate the number of rows satisfying the selection conditions.

The number of rows is between [nmin, nmax] (inclusive).

Implements ibis::table.

References ibis::countQuery::estimate(), ibis::countQuery::getMaxNumHits(), ibis::countQuery::getMinNumHits(), ibis::countQuery::setPartition(), and ibis::countQuery::setWhereClause().

void ibis::bord::estimate ( const ibis::qExpr cond,
uint64_t &  nmin,
uint64_t &  nmax 
) const
virtual

Estimate the number of rows satisfying the selection conditions.

The number of rows is between [nmin, nmax] (inclusive).

Implements ibis::table.

References ibis::countQuery::estimate(), ibis::countQuery::getMaxNumHits(), ibis::countQuery::getMinNumHits(), ibis::countQuery::setPartition(), and ibis::countQuery::setWhereClause().

ibis::bord * ibis::bord::evaluateTerms ( const ibis::selectClause sel,
const char *  desc 
) const
int64_t ibis::bord::getColumnAsBytes ( const char *  cname,
char *  vals,
uint64_t  begin = 0,
uint64_t  end = 0 
) const
virtual

Retrieve all values of the named column.

The member functions of this class only support access to one column at a time. Use table::cursor class for row-wise accesses.

The arguments begin and end are given in row numbers starting from 0. If begin < end, then rows begin till end-1 are packed into the output array. If 0 == end (i.e., leaving end as the default value), then the values from begin till end of the table is packed into the output array. The default values where both begin and end are 0 define a range covering all rows of the table.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Note
For fixed-width data types, the raw pointers are used to point to the values to be returned. In these cases, the caller is responsible for allocating enough storage for the values to be returned.

Implements ibis::table.

References ibis::array_t< T >::size(), ibis::column::type(), and ibis::UBYTE.

int64_t ibis::bord::getColumnAsDoubles ( const char *  cname,
double *  vals,
uint64_t  begin = 0,
uint64_t  end = 0 
) const
virtual

Retrieve all values of the named column.

The member functions of this class only support access to one column at a time. Use table::cursor class for row-wise accesses.

The arguments begin and end are given in row numbers starting from 0. If begin < end, then rows begin till end-1 are packed into the output array. If 0 == end (i.e., leaving end as the default value), then the values from begin till end of the table is packed into the output array. The default values where both begin and end are 0 define a range covering all rows of the table.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Note
For fixed-width data types, the raw pointers are used to point to the values to be returned. In these cases, the caller is responsible for allocating enough storage for the values to be returned.

Implements ibis::table.

References ibis::util::copy(), ibis::DOUBLE, ibis::FLOAT, ibis::INT, ibis::SHORT, ibis::array_t< T >::size(), ibis::column::type(), ibis::UBYTE, ibis::UINT, and ibis::USHORT.

int64_t ibis::bord::getColumnAsDoubles ( const char *  cname,
std::vector< double > &  vals,
uint64_t  begin = 0,
uint64_t  end = 0 
) const
virtual

Retrieve all values of the named column.

The member functions of this class only support access to one column at a time. Use table::cursor class for row-wise accesses.

The arguments begin and end are given in row numbers starting from 0. If begin < end, then rows begin till end-1 are packed into the output array. If 0 == end (i.e., leaving end as the default value), then the values from begin till end of the table is packed into the output array. The default values where both begin and end are 0 define a range covering all rows of the table.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Note
For fixed-width data types, the raw pointers are used to point to the values to be returned. In these cases, the caller is responsible for allocating enough storage for the values to be returned.

Implements ibis::table.

References ibis::util::copy(), ibis::DOUBLE, ibis::FLOAT, ibis::INT, ibis::SHORT, ibis::array_t< T >::size(), ibis::column::type(), ibis::UBYTE, ibis::UINT, and ibis::USHORT.

int64_t ibis::bord::getColumnAsFloats ( const char *  cname,
float *  vals,
uint64_t  begin = 0,
uint64_t  end = 0 
) const
virtual

Retrieve all values of the named column.

The member functions of this class only support access to one column at a time. Use table::cursor class for row-wise accesses.

The arguments begin and end are given in row numbers starting from 0. If begin < end, then rows begin till end-1 are packed into the output array. If 0 == end (i.e., leaving end as the default value), then the values from begin till end of the table is packed into the output array. The default values where both begin and end are 0 define a range covering all rows of the table.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Note
For fixed-width data types, the raw pointers are used to point to the values to be returned. In these cases, the caller is responsible for allocating enough storage for the values to be returned.

Implements ibis::table.

References ibis::util::copy(), ibis::FLOAT, ibis::SHORT, ibis::array_t< T >::size(), ibis::column::type(), ibis::UBYTE, and ibis::USHORT.

int64_t ibis::bord::getColumnAsInts ( const char *  cname,
int32_t *  vals,
uint64_t  begin = 0,
uint64_t  end = 0 
) const
virtual

Retrieve all values of the named column.

The member functions of this class only support access to one column at a time. Use table::cursor class for row-wise accesses.

The arguments begin and end are given in row numbers starting from 0. If begin < end, then rows begin till end-1 are packed into the output array. If 0 == end (i.e., leaving end as the default value), then the values from begin till end of the table is packed into the output array. The default values where both begin and end are 0 define a range covering all rows of the table.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Note
For fixed-width data types, the raw pointers are used to point to the values to be returned. In these cases, the caller is responsible for allocating enough storage for the values to be returned.

Implements ibis::table.

References ibis::util::copy(), ibis::INT, ibis::SHORT, ibis::array_t< T >::size(), ibis::column::type(), ibis::UBYTE, ibis::UINT, and ibis::USHORT.

int64_t ibis::bord::getColumnAsLongs ( const char *  cname,
int64_t *  vals,
uint64_t  begin = 0,
uint64_t  end = 0 
) const
virtual

Retrieve all values of the named column.

The member functions of this class only support access to one column at a time. Use table::cursor class for row-wise accesses.

The arguments begin and end are given in row numbers starting from 0. If begin < end, then rows begin till end-1 are packed into the output array. If 0 == end (i.e., leaving end as the default value), then the values from begin till end of the table is packed into the output array. The default values where both begin and end are 0 define a range covering all rows of the table.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Note
For fixed-width data types, the raw pointers are used to point to the values to be returned. In these cases, the caller is responsible for allocating enough storage for the values to be returned.

Implements ibis::table.

References ibis::util::copy(), ibis::INT, ibis::LONG, ibis::SHORT, ibis::array_t< T >::size(), ibis::column::type(), ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

int64_t ibis::bord::getColumnAsOpaques ( const char *  cname,
std::vector< ibis::opaque > &  vals,
uint64_t  begin = 0,
uint64_t  end = 0 
) const
virtual
int64_t ibis::bord::getColumnAsShorts ( const char *  cname,
int16_t *  vals,
uint64_t  begin = 0,
uint64_t  end = 0 
) const
virtual

Retrieve all values of the named column.

The member functions of this class only support access to one column at a time. Use table::cursor class for row-wise accesses.

The arguments begin and end are given in row numbers starting from 0. If begin < end, then rows begin till end-1 are packed into the output array. If 0 == end (i.e., leaving end as the default value), then the values from begin till end of the table is packed into the output array. The default values where both begin and end are 0 define a range covering all rows of the table.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Note
For fixed-width data types, the raw pointers are used to point to the values to be returned. In these cases, the caller is responsible for allocating enough storage for the values to be returned.

Implements ibis::table.

References ibis::util::copy(), ibis::SHORT, ibis::array_t< T >::size(), ibis::column::type(), ibis::UBYTE, and ibis::USHORT.

int64_t ibis::bord::getColumnAsStrings ( const char *  cname,
std::vector< std::string > &  vals,
uint64_t  begin = 0,
uint64_t  end = 0 
) const
virtual
int64_t ibis::bord::getColumnAsUBytes ( const char *  cname,
unsigned char *  vals,
uint64_t  begin = 0,
uint64_t  end = 0 
) const
virtual

Retrieve all values of the named column.

The member functions of this class only support access to one column at a time. Use table::cursor class for row-wise accesses.

The arguments begin and end are given in row numbers starting from 0. If begin < end, then rows begin till end-1 are packed into the output array. If 0 == end (i.e., leaving end as the default value), then the values from begin till end of the table is packed into the output array. The default values where both begin and end are 0 define a range covering all rows of the table.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Note
For fixed-width data types, the raw pointers are used to point to the values to be returned. In these cases, the caller is responsible for allocating enough storage for the values to be returned.

Implements ibis::table.

References ibis::array_t< T >::size(), ibis::column::type(), and ibis::UBYTE.

int64_t ibis::bord::getColumnAsUInts ( const char *  cname,
uint32_t *  vals,
uint64_t  begin = 0,
uint64_t  end = 0 
) const
virtual

Retrieve all values of the named column.

The member functions of this class only support access to one column at a time. Use table::cursor class for row-wise accesses.

The arguments begin and end are given in row numbers starting from 0. If begin < end, then rows begin till end-1 are packed into the output array. If 0 == end (i.e., leaving end as the default value), then the values from begin till end of the table is packed into the output array. The default values where both begin and end are 0 define a range covering all rows of the table.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Note
For fixed-width data types, the raw pointers are used to point to the values to be returned. In these cases, the caller is responsible for allocating enough storage for the values to be returned.

Implements ibis::table.

References ibis::util::copy(), ibis::INT, ibis::SHORT, ibis::array_t< T >::size(), ibis::column::type(), ibis::UBYTE, ibis::UINT, and ibis::USHORT.

int64_t ibis::bord::getColumnAsULongs ( const char *  cname,
uint64_t *  vals,
uint64_t  begin = 0,
uint64_t  end = 0 
) const
virtual

Retrieve all values of the named column.

The member functions of this class only support access to one column at a time. Use table::cursor class for row-wise accesses.

The arguments begin and end are given in row numbers starting from 0. If begin < end, then rows begin till end-1 are packed into the output array. If 0 == end (i.e., leaving end as the default value), then the values from begin till end of the table is packed into the output array. The default values where both begin and end are 0 define a range covering all rows of the table.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Note
For fixed-width data types, the raw pointers are used to point to the values to be returned. In these cases, the caller is responsible for allocating enough storage for the values to be returned.

Implements ibis::table.

References ibis::util::copy(), ibis::INT, ibis::LONG, ibis::SHORT, ibis::array_t< T >::size(), ibis::column::type(), ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

int64_t ibis::bord::getColumnAsUShorts ( const char *  cname,
uint16_t *  vals,
uint64_t  begin = 0,
uint64_t  end = 0 
) const
virtual

Retrieve all values of the named column.

The member functions of this class only support access to one column at a time. Use table::cursor class for row-wise accesses.

The arguments begin and end are given in row numbers starting from 0. If begin < end, then rows begin till end-1 are packed into the output array. If 0 == end (i.e., leaving end as the default value), then the values from begin till end of the table is packed into the output array. The default values where both begin and end are 0 define a range covering all rows of the table.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Note
For fixed-width data types, the raw pointers are used to point to the values to be returned. In these cases, the caller is responsible for allocating enough storage for the values to be returned.

Implements ibis::table.

References ibis::util::copy(), ibis::SHORT, ibis::array_t< T >::size(), ibis::column::type(), ibis::UBYTE, and ibis::USHORT.

double ibis::bord::getColumnMax ( const char *  cname) const
virtual

Compute the maximum of all valid values in the name column.

In case of error, such as an invalid column name or an empty table, this function will return FASTBIT_DOUBLE_NULL or -DBL_MAX to ensure that the following test fails getColumnMin <= getColumnMax.

Implements ibis::table.

double ibis::bord::getColumnMin ( const char *  cname) const
virtual

Compute the minimum of all valid values in the name column.

In case of error, such as an invalid column name or an empty table, this function will return FASTBIT_DOUBLE_NULL or DBL_MAX to ensure that the following test fails getColumnMin <= getColumnMax.

Implements ibis::table.

long ibis::bord::getHistogram ( const char *  constraints,
const char *  cname,
double  begin,
double  end,
double  stride,
std::vector< uint32_t > &  counts 
) const
virtual

Compute the histogram of the named column. This version uses the user specified bins:

[begin, begin+stride) [begin+stride, begin+2*stride) ....

A record is placed in bin

(x - begin) / stride,

where the first bin is bin 0. The total number of bins is

1 + floor((end - begin) / stride).
Note
Records (rows) outside of the range [begin, end] are not counted.
Non-positive stride is considered as an error.
If end is less than begin, an empty array counts is returned along with return value 0.

Implements ibis::table.

References ibis::util::copy().

long ibis::bord::getHistogram2D ( const char *  constraints,
const char *  cname1,
double  begin1,
double  end1,
double  stride1,
const char *  cname2,
double  begin2,
double  end2,
double  stride2,
std::vector< uint32_t > &  counts 
) const
virtual

Compute a two-dimension histogram on columns cname1 and cname2.

The bins along each dimension are defined the same way as in function getHistogram. The array counts stores the two-dimensional bins with the first dimension as the slow varying dimension following C convention for ordering multi-dimensional arrays.

Implements ibis::table.

References ibis::util::copy().

long ibis::bord::getHistogram3D ( const char *  constraints,
const char *  cname1,
double  begin1,
double  end1,
double  stride1,
const char *  cname2,
double  begin2,
double  end2,
double  stride2,
const char *  cname3,
double  begin3,
double  end3,
double  stride3,
std::vector< uint32_t > &  counts 
) const
virtual

Compute a three-dimensional histogram on the named columns.

The triplets <begin, end, stride> are used the same ways in getHistogram and getHistogram2D. The three dimensional bins are linearized in counts with the first being the slowest varying dimension and the third being the fastest varying dimension following the C convention for ordering multi-dimensional arrays.

Implements ibis::table.

References ibis::util::copy().

ibis::table * ibis::bord::groupby ( const ibis::table::stringArray ) const
virtual

Perform aggregate functions on the current table.

It produces a new table. The list of strings passed to this function are interpreted as a set of names followed by a set of functions. Currently, only functions COUNT, AVG, MIN, MAX, SUM, VARPOP, VARSAMP, STDPOP, STDSAMP and DISTINCT are supported, and the functions can only accept a column name as arguments.

Implements ibis::table.

Referenced by ibis::filter::sift0(), ibis::filter::sift1(), and ibis::filter::sift2().

ibis::table * ibis::bord::groupby ( const char *  str) const
virtual

Perform a group-by operation.

The column names and operations are separated by commas.

Reimplemented from ibis::table.

ibis::bord * ibis::bord::groupbya ( const ibis::bord src,
const ibis::selectClause sel 
)
static

Perform the aggregation operations specified in the select clause.

If there is any further computation on the aggregated values, the user needs to call groupbyc to complete those operations. This separation allows one to possibly conduct group by operations on multiple data partitions one partition at a time, which reduces the memory requirement.

References ibis::selectClause::aggDescription(), ibis::selectClause::aggExpr(), ibis::selectClause::aggName(), ibis::selectClause::aggSize(), ibis::CATEGORY, ibis::bundle::create(), ibis::DOUBLE, ibis::selectClause::empty(), ibis::FLOAT, ibis::table::freeBuffers(), ibis::selectClause::getAggregator(), ibis::column::getDictionary(), ibis::INT, ibis::LONG, nRows(), ibis::array_t< T >::push_back(), ibis::util::randName(), ibis::util::ref(), ibis::SHORT, ibis::TEXT, ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, ibis::UNKNOWN_TYPE, and ibis::USHORT.

Referenced by ibis::filter::sift0S(), ibis::filter::sift1S(), and ibis::filter::sift2S().

ibis::bord * ibis::bord::groupbyc ( const ibis::bord src,
const ibis::selectClause sel 
)
static

The function to perform the final computations specified by the select clause.

This is to be called after all the aggregation operations have been performed. The objective to separate the aggregation operations and the final arithmetic operations is to allow the aggregation operations to be performed on different data partitions separately.

Note
The incoming ibis::bord object must be the output from ibis::bord::groupbya.

References ibis::part::calculate(), ibis::CATEGORY, copyColumn(), ibis::DOUBLE, ibis::selectClause::empty(), ibis::table::freeBuffers(), ibis::selectClause::getTerms(), nRows(), ibis::selectClause::numTerms(), ibis::util::randName(), ibis::util::ref(), ibis::bitvector::set(), ibis::selectClause::termName(), ibis::TEXT, and ibis::UNKNOWN_TYPE.

Referenced by ibis::filter::sift0S(), ibis::filter::sift1S(), and ibis::filter::sift2S().

virtual void ibis::bord::indexSpec ( const char *  opt,
const char *  colname 
)
inlinevirtual

Replace the current indexing option.

If no column name is specified, it resets the indexing option for the table.

Implements ibis::table.

virtual const char* ibis::bord::indexSpec ( const char *  colname) const
inlinevirtual

Retrieve the current indexing option.

If no column name is specified, it retrieve the indexing option for the table.

Implements ibis::table.

int ibis::bord::limit ( uint32_t  nr)

Reset the number of rows in the data partition to be nr.

If the existing data partitioning has no more than rows, nothing is done, otherwise, the first nr rows are kept.

It retunrs 0 to indicate normal completion, a negative number to indicate error.

Referenced by ibis::filter::sift0S(), ibis::filter::sift1S(), and ibis::filter::sift2S().

int ibis::bord::merge ( const ibis::bord rhs,
const ibis::selectClause sel 
)

Merge the incoming data partition with this one.

This function is intended to combine partial results produced by ibis::bord::groupbya; both this and rhs must be produced with the same select clause sel. It only work with separable aggregation operators.

It returns the number of rows in the combined result upon a successful completion, otherwise, it returns a negative number.

References ibis::selectClause::aggName(), ibis::selectClause::aggSize(), ibis::fileManager::bytesInUse(), ibis::part::columns, describe(), dump(), ibis::selectClause::getAggregator(), ibis::part::getColumn(), ibis::util::groupby1000(), merge0(), merge10(), merge11(), merge12(), merge20(), merge21(), merger(), ibis::part::name(), ibis::table::name(), nColumns(), ibis::part::nEvents, nRows(), ibis::part::nRows(), and ibis::column::type().

int ibis::bord::merge0 ( std::vector< ibis::bord::column * > &  vals,
const std::vector< ibis::bord::column * > &  valr,
const std::vector< ibis::selectClause::AGREGADO > &  agg 
)
staticprotected

Merge values according to the given operators.

The corresponding group-by keys match, only the values needs to be updated.

References ibis::DOUBLE, ibis::FLOAT, ibis::INT, ibis::LONG, ibis::SHORT, ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

Referenced by merge().

template<typename T >
int ibis::bord::merge0T ( ibis::array_t< T > &  vs,
const ibis::array_t< T > &  vr,
ibis::selectClause::AGREGADO  ag 
)
staticprotected

Template function to perform the merger operations on arrays with matching keys.

References ibis::array_t< T >::size().

template<typename Tk >
int ibis::bord::merge10T ( ibis::array_t< Tk > &  kout,
std::vector< ibis::bord::column * > &  vout,
const ibis::array_t< Tk > &  kin1,
const std::vector< ibis::bord::column * > &  vin1,
const ibis::array_t< Tk > &  kin2,
const std::vector< ibis::bord::column * > &  vin2,
const std::vector< ibis::selectClause::AGREGADO > &  agg 
)
staticprotected

Perform merge operation with one key column and an arbitrary number of value columns.

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

template<typename Tk , typename Tv >
int ibis::bord::merge11T ( ibis::array_t< Tk > &  kout,
ibis::array_t< Tv > &  vout,
const ibis::array_t< Tk > &  kin1,
const ibis::array_t< Tv > &  vin1,
const ibis::array_t< Tk > &  kin2,
const ibis::array_t< Tv > &  vin2,
ibis::selectClause::AGREGADO  agg 
)
staticprotected

Template to perform merge operation with one column as key and one column as value.

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

template<typename Tk1 >
int ibis::bord::merge20T1 ( ibis::array_t< Tk1 > &  k1out,
const ibis::array_t< Tk1 > &  k1in1,
const ibis::array_t< Tk1 > &  k1in2,
ibis::bord::column k21,
std::vector< ibis::bord::column * > &  vin1,
const ibis::bord::column k22,
const std::vector< ibis::bord::column * > &  vin2,
const std::vector< ibis::selectClause::AGREGADO > &  agg 
)
staticprotected
template<typename Tk1 , typename Tk2 >
int ibis::bord::merge20T2 ( ibis::array_t< Tk1 > &  k1out,
ibis::array_t< Tk2 > &  k2out,
std::vector< ibis::bord::column * > &  vout,
const ibis::array_t< Tk1 > &  k1in1,
const ibis::array_t< Tk2 > &  k2in1,
const std::vector< ibis::bord::column * > &  vin1,
const ibis::array_t< Tk1 > &  k1in2,
const ibis::array_t< Tk2 > &  k2in2,
const std::vector< ibis::bord::column * > &  vin2,
const std::vector< ibis::selectClause::AGREGADO > &  agg 
)
staticprotected

Merge in-memory table with two keys and more than one value columns.

Both key columns are templated.

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

template<typename Tk1 >
int ibis::bord::merge21T1 ( ibis::array_t< Tk1 > &  k1out,
const ibis::array_t< Tk1 > &  k1in1,
const ibis::array_t< Tk1 > &  k1in2,
ibis::bord::column k21,
ibis::bord::column v1,
const ibis::bord::column k22,
const ibis::bord::column v2,
ibis::selectClause::AGREGADO  ag 
)
staticprotected
template<typename Tk1 , typename Tk2 >
int ibis::bord::merge21T2 ( ibis::array_t< Tk1 > &  k1out,
ibis::array_t< Tk2 > &  k2out,
const ibis::array_t< Tk1 > &  k1in1,
const ibis::array_t< Tk2 > &  k2in1,
const ibis::array_t< Tk1 > &  k1in2,
const ibis::array_t< Tk2 > &  k2in2,
ibis::bord::column v1,
const ibis::bord::column v2,
ibis::selectClause::AGREGADO  ag 
)
staticprotected
template<typename Tk1 , typename Tk2 , typename Tv >
int ibis::bord::merge21T3 ( ibis::array_t< Tk1 > &  k1out,
ibis::array_t< Tk2 > &  k2out,
ibis::array_t< Tv > &  vout,
const ibis::array_t< Tk1 > &  k1in1,
const ibis::array_t< Tk2 > &  k2in1,
const ibis::array_t< Tv > &  vin1,
const ibis::array_t< Tk1 > &  k1in2,
const ibis::array_t< Tk2 > &  k2in2,
const ibis::array_t< Tv > &  vin2,
ibis::selectClause::AGREGADO  av 
)
staticprotected

Merge two key columns with one value column.

The two key columns and the value column are all templated.

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

int ibis::bord::merger ( std::vector< ibis::bord::column * > &  keys,
std::vector< ibis::bord::column * > &  vals,
const std::vector< ibis::bord::column * > &  keyr,
const std::vector< ibis::bord::column * > &  valr,
const std::vector< ibis::selectClause::AGREGADO > &  agg 
)
staticprotected

Merge values from two partial results and place the final resules in the first argument.

This is the most generic version that expects the keys to not match and therefore needs to produce a new set of values. It also uses the generic algorithm for comparisons, where each comparison of a pair of values requires a function call.

References ibis::util::ref().

Referenced by merge().

void ibis::bord::orderby ( const ibis::table::stringArray )
virtual

Reorder the rows.

Sort the rows in ascending order of the columns specified in the list of column names. This function is not designated const even though it does not change the content in SQL logic, but it may change internal representations.

Note
If an empty list is passed to this function, it will reorder rows using all columns with the column having the smallest number of distinct values first.

Implements ibis::table.

References ibis::util::reorder().

long ibis::bord::reorder ( )
virtual

Sort rows with the lowest cardinality column first.

Only integer-valued columns are used in sorting. Returns the number of rows reordered when successful, otherwise return a negative number and the base data is corrupt!

Note
A data partition declared readonly at construction time can be reordered because reordering does not change the relational algebra view of the data. However, this function actually makes changes to the ibis::part object, the object itself must be modifiable, i.e., not a const object.
Warning
: This function does not work with any string valued columns.

Reimplemented from ibis::part.

References ibis::part::reorder().

long ibis::bord::reorder ( const ibis::table::stringArray names,
const std::vector< bool > &  directions 
)
virtual

Sort rows according the values of the columns specified in names.

It orders the rows according the values of names[0] first, names[1] second, and so on. For each column, if the corresponding value of directions is present, the value of directions is interpreted as whether or not the column is to be order in ascending order. The direction defaults to the ascending order if the value is not present.

Note
The sorting operation can proceed on a data partition marked as read-only at construction time. If the data partition is not read-only, then this function will attempt to purge the inactive rows which will reduce the number of rows in the data partition.
Warning
This function does not use string values as sort key! Incoming names for categorical values and text are simply ignored. However, in most case, the categorical values would be internally represented as unsigned integers and be ordered using their integer representations (NOT the string values).

Reimplemented from ibis::part.

References ibis::CATEGORY, ibis::DOUBLE, ibis::array_t< T >::find(), ibis::FLOAT, ibis::INT, ibis::LONG, ibis::part::name(), ibis::array_t< T >::push_back(), ibis::SHORT, ibis::array_t< T >::size(), ibis::array_t< T >::sort(), ibis::util::sortStrings(), ibis::array_t< T >::swap(), ibis::TEXT, ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

long ibis::bord::reorderStrings ( std::vector< std::string > &  vals,
const array_t< uint32_t > &  ind 
) const

Reorder the vector of strings.

To avoid recreating the content of the string values, this function uses swap operations to move the existing strings into their new locations. It only works if ind is a proper permutation of integers between 0 and vals.size() (include 0 but exclude vals.size()), however, it does not check whether the input array is a proper permutation.

References ibis::util::logMessage(), and ibis::array_t< T >::size().

int ibis::bord::restoreCategoriesAsStrings ( const ibis::part ref)

Convert the integer representation of categorical columns back to the string representation.

The argument is used to determine if the original column was categorical values.

Upon successful completion of this function, it returns the number of rows in the column. It returns a negative number to indicate errors.

References ibis::part::getColumn(), and ibis::UINT.

ibis::table * ibis::bord::select ( const char *  sel,
const char *  cond 
) const
virtual

Given a set of column names and a set of selection conditions, compute another table that represents the selected values.

Implements ibis::table.

References ibis::table::select().

long ibis::bord::sortStrings ( std::vector< std::string > &  vals,
array_t< uint32_t > &  starts,
array_t< uint32_t > &  idxout,
const array_t< uint32_t > &  idxin,
bool  ascending 
) const
template<typename T >
long ibis::bord::sortValues ( array_t< T > &  vals,
array_t< uint32_t > &  starts,
array_t< uint32_t > &  idxout,
const array_t< uint32_t > &  idxin,
bool  ascending 
) const

A simple sorting procedure.

The incoming values in vals are divided into segements with starts. Within each segement, this function orders the values in ascending order by default unless ascending[i] is present and is false.

Note
This function uses a simple algorithm and requires space for a copy of vals plus a copy of starts.

References ibis::array_t< T >::clear(), ibis::array_t< T >::copy(), ibis::horometer::CPUTime(), ibis::part::name(), ibis::array_t< T >::push_back(), ibis::horometer::realTime(), ibis::array_t< T >::resize(), ibis::array_t< T >::size(), ibis::array_t< T >::sort(), ibis::util::sortKeys(), ibis::horometer::start(), ibis::horometer::stop(), and ibis::array_t< T >::swap().

ibis::table * ibis::bord::xgroupby ( const ibis::selectClause sel) const

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