Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Friends
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

List of all members.

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.
int append (const ibis::selectClause &, const ibis::part &, const ibis::qContinuousRange &)
 Append the rows satisfying the specified range expression.
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.
 bord (const char *tn, const char *td, uint64_t nr, ibis::table::bufferList &buf, const ibis::table::typeList &ct, const ibis::table::stringList &cn, const ibis::table::stringList *cdesc=0, const std::vector< const ibis::dictionary * > *dct=0)
 Constructor.
 bord (const char *tn, const char *td, const ibis::selectClause &sc, const ibis::part &ref)
 Constructor.
 bord (const char *tn, const char *td, const ibis::selectClause &sc, const ibis::constPartList &ref)
 Constructor.
virtual int buildIndex (const char *, const char *)
 The following functions deal with auxillary data for accelerating query processing, primarily for building indexes.
virtual int buildIndexes (const char *)
 Create indexes for every column of the table.
virtual int buildIndexes (const char *, int)
 Make sure indexes for all columns are available.
virtual ibis::table::stringList columnNames () const
virtual ibis::table::typeList columnTypes () const
 Return column types in a list.
void copyColumn (const char *, ibis::TYPE_T &, void *&, const ibis::dictionary *&) const
 Copy the type and values of the named column.
virtual ibis::table::cursorcreateCursor () const
 Create a cursor object to perform row-wise data access.
virtual void describe (std::ostream &) const
 Print a description of the table to the specified output stream.
virtual int dump (std::ostream &, const char *) const
 Print the values in ASCII form to the specified output stream.
virtual int dump (std::ostream &, uint64_t, const char *) const
 Print the first nr rows of the data to the given output stream.
virtual int dump (std::ostream &, uint64_t, uint64_t, const char *) const
 Print nr rows starting with row offset.
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.
virtual void estimate (const ibis::qExpr *cond, uint64_t &nmin, uint64_t &nmax) const
 Estimate the number of rows satisfying the selection conditions.
ibis::tableevaluateTerms (const ibis::selectClause &, const char *) const
 Evaluate the arithmetic expressions in the select clause to derive an in-memory data table.
virtual int64_t getColumnAsBytes (const char *, char *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column.
virtual int64_t getColumnAsDoubles (const char *, double *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column.
virtual int64_t getColumnAsDoubles (const char *, std::vector< double > &, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column.
virtual int64_t getColumnAsFloats (const char *, float *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column.
virtual int64_t getColumnAsInts (const char *, int32_t *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column.
virtual int64_t getColumnAsLongs (const char *, int64_t *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column.
virtual int64_t getColumnAsShorts (const char *, int16_t *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column.
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.
virtual int64_t getColumnAsUBytes (const char *, unsigned char *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column.
virtual int64_t getColumnAsUInts (const char *, uint32_t *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column.
virtual int64_t getColumnAsULongs (const char *, uint64_t *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column.
virtual int64_t getColumnAsUShorts (const char *, uint16_t *, uint64_t=0, uint64_t=0) const
 Retrieve all values of the named column.
virtual double getColumnMax (const char *) const
 Compute the maximum of all valid values in the name column.
virtual double getColumnMin (const char *) const
 Compute the minimum of all valid values in the name column.
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.
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.
virtual int getPartitions (constPartList &) const
 Retrieve the list of partitions.
virtual tablegroupby (const ibis::table::stringList &) const
 Perform aggregate functions on the current table.
virtual tablegroupby (const char *str) const
 Perform a group-by operation.
ibis::tablegroupby (const ibis::selectClause &) const
virtual void indexSpec (const char *, const char *)
 Replace the current indexing option.
virtual const char * indexSpec (const char *) const
 Retrieve the current indexing option.
int limit (uint32_t)
int merge (const ibis::bord &, const ibis::selectClause &)
 Merge the incoming data partition with this one.
virtual uint32_t nColumns () const
 Return the number of attributes in the partition.
virtual uint64_t nRows () const
 Return the number of rows.
virtual void orderby (const ibis::table::stringList &)
 Reorder the rows.
virtual void orderby (const ibis::table::stringList &, const std::vector< bool > &)
int renameColumns (const ibis::selectClause &)
virtual long reorder ()
 Sort rows with the lowest cardinality column first.
virtual long reorder (const ibis::table::stringList &)
virtual long reorder (const ibis::table::stringList &, const std::vector< bool > &)
 Sort rows according the values of the columns specified in names.
long reorderStrings (std::vector< std::string > &vals, const array_t< uint32_t > &ind) const
 Reorder the vector of strings.
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.
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.
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.
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.
ibis::tablexgroupby (const ibis::selectClause &) const
 The actual function to perform the group by operation.

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.
static ibis::bordgroupbya (const ibis::bord &, const ibis::selectClause &)
 Perform the aggregation operations specified in the select clause.
static ibis::bordgroupbyc (const ibis::bord &, const ibis::selectClause &)
 The function to perform the final computations specified by the select clause.

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.

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.
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.
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.
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.
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.
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.
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.
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.
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.
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.

Friends

class cursor

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 are limited. Even when there is sufficient memory, because the number of rows is internally stored in a 32-bit unsigned integer, it can store no more than 4 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::bufferList buf,
const ibis::table::typeList ct,
const ibis::table::stringList cn,
const ibis::table::stringList 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 paritions 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::bord::column::getDictionary(), ibis::gVerbose, ibis::column::loadIndex(), ibis::part::m_desc, ibis::part::m_name, ibis::part::name(), ibis::column::name(), ibis::table::name_, ibis::bord::column::setDictionary(), ibis::util::shortName(), ibis::part::skipPrefix(), ibis::util::strnewdup(), ibis::column::type(), and ibis::UINT.


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::gVerbose, ibis::part::name(), ibis::column::name(), ibis::bitvector::set(), and ibis::array_t< T >::size().

Referenced by ibis::bord::column::append(), 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::gVerbose, ibis::part::name(), ibis::column::name(), ibis::part::nEvents, ibis::bitvector::set(), 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]
virtual int ibis::bord::buildIndex ( const char *  colname,
const char *  option 
) [inline, virtual]

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) [inline, virtual]

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.

virtual int ibis::bord::buildIndexes ( const char *  iopt,
int  nthr 
) [inline, virtual]

Make sure indexes for all columns are available.

May use nthr threads to build indexes. The argument iopt is used to build new indexes if the corresponding columns do not already have indexes.

See also:
ibis::part::loadIndexes

Reimplemented from ibis::part.

Note:
The pointers returned are pointing to names stored internally. The caller should not attempt to free these pointers.

Reimplemented from ibis::part.

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::BYTE, ibis::CATEGORY, ibis::DOUBLE, ibis::FLOAT, ibis::bord::column::getDictionary(), ibis::column::getValuesArray(), ibis::gVerbose, 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 
) [inline, static]

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::BYTE, ibis::CATEGORY, ibis::DOUBLE, ibis::FLOAT, ibis::INT, ibis::LONG, ibis::SHORT, ibis::TEXT, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

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

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().

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::table * 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 begin >= end, 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.

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::BYTE, ibis::util::copy(), 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 begin >= end, 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.

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::BYTE, 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 begin >= end, 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.

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::BYTE, 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 begin >= end, 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.

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::BYTE, 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 begin >= end, 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.

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::BYTE, 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 begin >= end, 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.

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::BYTE, 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::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 begin >= end, 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.

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::BYTE, 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]

Retrieve the null-terminated strings as a vector of std::string objects.

Both ibis::CATEGORY and ibis::TEXT types can be retrieved using this function.

Implements ibis::table.

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

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 begin >= end, 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.

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::BYTE, ibis::util::copy(), 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 begin >= end, 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.

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::BYTE, 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 begin >= end, 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.

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::BYTE, 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 begin >= end, 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.

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::BYTE, 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::stringList ) 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 need to call groupbyc to complete those operations. This separation allows one to possibly conduct group by operations on multiple data partitions on partition at a time, which should reduce the memory requirement.

References ibis::selectClause::aggDescription(), ibis::selectClause::aggExpr(), ibis::selectClause::aggName(), ibis::selectClause::aggSize(), ibis::BYTE, ibis::CATEGORY, ibis::bundle::create(), ibis::DOUBLE, ibis::selectClause::empty(), ibis::FLOAT, ibis::table::freeBuffers(), ibis::selectClause::getAggregator(), ibis::bord::column::getDictionary(), ibis::gVerbose, ibis::INT, ibis::LONG, nRows(), ibis::array_t< T >::push_back(), ibis::util::randName(), ibis::util::ref(), ibis::SHORT, ibis::TEXT, ibis::column::type(), 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(), ibis::gVerbose, nRows(), ibis::selectClause::numTerms(), ibis::util::ref(), ibis::bitvector::set(), ibis::util::shortName(), ibis::selectClause::termName(), 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 
) [inline, virtual]

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 [inline, virtual]

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::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::part::columns, ibis::selectClause::getAggregator(), ibis::part::getColumn(), ibis::gVerbose, ibis::part::name(), nColumns(), nRows(), ibis::part::nRows(), and ibis::column::type().

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

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

Merge values according to the given operators.

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

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

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

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 
) [static, protected]

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 
) [static, protected]

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 
) [static, protected]
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 
) [static, protected]

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 
) [static, protected]
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 
) [static, protected]
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 
) [static, protected]

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 
) [static, protected]

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().

void ibis::bord::orderby ( const ibis::table::stringList ) [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.

The lowest cardinality column is ordered 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!

Warning:
Danger: This function does not update null masks!

Reimplemented from ibis::part.

References ibis::util::reorder().

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::gVerbose, and ibis::array_t< T >::size().

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::gVerbose, 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().


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