Class ibis::bord stores all its data in memory. More...
#include <bord.h>
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 &) |
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, const ibis::selectClause &sc, const ibis::part &ref) | |
Constructor. | |
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) | |
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 |
Copy the type and values of the named column. | |
virtual ibis::table::cursor * | createCursor () 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 void | dumpNames (std::ostream &, const char *) const |
Print all column names on one line. | |
virtual void | estimate (const ibis::qExpr *cond, uint64_t &nmin, uint64_t &nmax) const |
Estimate the number of rows satisfying the selection conditions. | |
virtual void | estimate (const char *cond, uint64_t &nmin, uint64_t &nmax) const |
Estimate the number of rows satisfying the selection conditions. | |
ibis::table * | evaluateTerms (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 (std::vector< const ibis::part * > &) const |
Retrieve the list of partitions. | |
virtual table * | groupby (const char *str) const |
Perform a group-by operation. | |
virtual table * | groupby (const ibis::table::stringList &) const |
Perform aggregate functions on the current table. | |
ibis::table * | groupby (const ibis::selectClause &) const |
The actual function to perform the group by operation. | |
virtual const char * | indexSpec (const char *) const |
Retrieve the current indexing option. | |
virtual void | indexSpec (const char *, const char *) |
Replace the current indexing option. | |
int | limit (uint32_t) |
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 (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 . | |
virtual long | reorder () |
Sort rows with the lowest cardinality column first. | |
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 char *) |
Convert the integer representation to string representation. | |
virtual void | reverseRows () |
Reverse the order of the rows. | |
virtual table * | select (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. | |
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. | |
Protected Member Functions | |
void | clear () |
Clear the existing content. | |
int64_t | computeHits (const char *cond) const |
Compute the number of hits. | |
Friends | |
class | cursor |
Class ibis::bord stores all its data in memory.
The function ibis::table::select
produces an ibis::bord object to store nontrivial results. Since all data records are stored in memory, the number of rows that can be stored are limited. This also implies that the function ibis::table::select will not be able to produce a proper table object if the selection is very large. An additional limit is that the number of rows is internally stored in a 32-bit unsigned integer, which can store no more than 4 billion rows.
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 |
||
) |
Constructor.
The responsibility of freeing the memory pointed by the elements of buf is transferred to this object.
References ibis::part::amask, ibis::part::colorder, ibis::part::columns, ibis::table::desc_, ibis::table::freeBuffer(), ibis::gVerbose, ibis::part::m_desc, ibis::part::m_name, ibis::column::name(), ibis::table::name_, ibis::part::nEvents, ibis::bitvector::set(), ibis::util::shortName(), ibis::array_t< T >::size(), ibis::util::strnewdup(), and ibis::part::switchTime.
ibis::bord::bord | ( | const char * | tn, |
const char * | td, | ||
const ibis::selectClause & | sc, | ||
const ibis::part & | ref | ||
) |
Constructor.
It produces an in-memory version of the selected values for further operations. The reference data partition ref is used to determine the data types.
References ibis::selectClause::aggExpr(), ibis::part::colorder, ibis::part::columns, ibis::table::desc_, ibis::DOUBLE, ibis::part::getColumn(), ibis::selectClause::getOrdered(), ibis::gVerbose, ibis::part::m_desc, ibis::part::m_name, ibis::part::name(), ibis::column::name(), ibis::table::name_, ibis::util::shortName(), ibis::part::skipPrefix(), ibis::util::strnewdup(), 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::BYTE, ibis::CATEGORY, ibis::bitvector::clear(), ibis::bitvector::cnt(), ibis::horometer::CPUTime(), ibis::DOUBLE, ibis::FLOAT, ibis::fileManager::flushDir(), ibis::gParameters(), ibis::gVerbose, ibis::column::indexSpec(), ibis::fileManager::instance(), ibis::INT, ibis::LONG, ibis::util::makeDir(), ibis::column::name(), ibis::horometer::realTime(), 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::part::writeColumn(), and ibis::part::writeString().
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.
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.
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.
Reimplemented from ibis::part.
ibis::table::stringList ibis::bord::columnNames | ( | ) | const [virtual] |
Reimplemented from ibis::part.
References ibis::part::columnNames().
void ibis::bord::copyColumn | ( | const char * | nm, |
ibis::TYPE_T & | t, | ||
void *& | buf | ||
) | 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::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.
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::BYTE, ibis::CATEGORY, ibis::DOUBLE, ibis::FLOAT, ibis::gVerbose, ibis::INT, ibis::LONG, ibis::SHORT, ibis::TEXT, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.
Referenced by ibis::jRange::fillResult(), and ibis::jNatural::fillResult().
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().
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.
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 |
Evaluate the arithmetic expressions in the select clause to derive an in-memory data table.
References ibis::selectClause::aggDescription(), ibis::selectClause::aggExpr(), ibis::selectClause::aggName(), ibis::selectClause::aggSize(), ibis::BYTE, ibis::CATEGORY, ibis::DOUBLE, ibis::selectClause::empty(), ibis::math::term::eval(), ibis::FLOAT, ibis::table::freeBuffers(), ibis::selectClause::getString(), ibis::gVerbose, ibis::INT, ibis::LONG, ibis::array_t< T >::push_back(), ibis::util::ref(), ibis::bitvector::set(), ibis::SHORT, ibis::util::shortName(), ibis::array_t< T >::size(), ibis::TEXT, ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.
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.
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.
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.
Implements ibis::table.
References ibis::BYTE, ibis::util::copy(), ibis::DOUBLE, ibis::FLOAT, ibis::INT, ibis::array_t< T >::resize(), 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.
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.
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.
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.
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::array_t< T >::resize(), 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.
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.
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.
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.
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).
stride
is considered as an error. 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::selectClause & | sel | ) | const |
The actual function to perform the group by operation.
References ibis::selectClause::aggDescription(), ibis::selectClause::aggExpr(), ibis::selectClause::aggName(), ibis::selectClause::aggSize(), ibis::BYTE, ibis::CATEGORY, ibis::bundle::create(), ibis::util::guardBase::dismiss(), ibis::DOUBLE, ibis::selectClause::empty(), ibis::FLOAT, ibis::table::freeBuffers(), ibis::selectClause::getAggregator(), ibis::selectClause::getTerms(), ibis::gVerbose, ibis::INT, ibis::LONG, ibis::selectClause::print(), ibis::array_t< T >::push_back(), ibis::util::ref(), ibis::array_t< T >::resize(), ibis::bitvector::set(), ibis::SHORT, ibis::util::shortName(), ibis::bitvector::size(), ibis::selectClause::termName(), ibis::TEXT, ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, ibis::UNKNOWN_TYPE, and ibis::USHORT.
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::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.
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.
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.
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.
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!
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().
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 |
Sort the string values.
It preserves the previous order determined represented by idxin and 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::util::sortStrings(), ibis::horometer::start(), ibis::horometer::stop(), and ibis::array_t< T >::swap().
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.
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().
![]() |