A trivial class for a table with exactly one row, one column and one integer value. More...
#include <tab.h>
Classes | |
class | cursor |
Public Member Functions | |
virtual int | backup (const char *, const char *=0, const char *=0) const |
The backup operation. It does nothing. | |
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. | |
const char * | colName () const |
virtual stringList | columnNames () const |
Return column names. | |
virtual typeList | columnTypes () const |
Return data types. | |
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 &out, uint64_t nr, const char *sep) const |
Print the first nr rows. | |
virtual int | dump (std::ostream &out, uint64_t off, uint64_t nr, const char *sep) 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 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. | |
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 *cn, int64_t *vals, uint64_t begin=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 *cn, uint32_t *vals, uint64_t begin=0, uint64_t=0) const |
Retrieve all values of the named column. | |
virtual int64_t | getColumnAsULongs (const char *cn, uint64_t *vals, uint64_t begin=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 *cn) const |
Compute the maximum of all valid values in the name column. | |
virtual double | getColumnMin (const char *cn) 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 table * | groupby (const stringList &) const |
Perform aggregate functions on the current table. | |
virtual table * | groupby (const char *) const |
Perform a 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. | |
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 stringList &, const std::vector< bool > &) |
virtual void | orderby (const stringList &) |
Reorder the rows. | |
virtual void | orderby (const char *) |
Reorder the rows. The column names are separated by commas. | |
virtual void | reverseRows () |
Reverse the order of the rows. | |
virtual table * | select (const char *, const char *) const |
Given a set of column names and a set of selection conditions, compute another table that represents the selected values. | |
tabele (const char *na, const char *de, uint64_t nr, const char *nm=0) | |
Constructor. | |
tabele (uint64_t nr=0, const char *nm=0) | |
Constructor. | |
Friends | |
class | cursor |
A trivial class for a table with exactly one row, one column and one integer value.
This type of table is generated when the select clause is "count(*)". This class could be replaced with ibis::tabula, however, treating the output of "count(*)" as a one-row-and-one-column table is closer to the ODBC/JDBC convention.
ibis::tabele::tabele | ( | const char * | na, |
const char * | de, | ||
uint64_t | nr, | ||
const char * | nm = 0 |
||
) | [inline] |
Constructor.
If the name of the sole column is not given, it is assumed to be "nrows".
ibis::tabele::tabele | ( | uint64_t | nr = 0 , |
const char * | nm = 0 |
||
) | [inline, explicit] |
Constructor.
A table name will be generated automatically based on the current time. If the name of the sole column is not specified, it is assumed to be "nrows".
virtual int ibis::tabele::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::tabele::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.
int ibis::tabele::dump | ( | std::ostream & | out, |
const char * | del | ||
) | const [inline, 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 dump().
virtual int ibis::tabele::dump | ( | std::ostream & | out, |
uint64_t | offset, | ||
uint64_t | nr, | ||
const char * | del | ||
) | const [inline, 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 dump().
void ibis::tabele::estimate | ( | const char * | cond, |
uint64_t & | nmin, | ||
uint64_t & | nmax | ||
) | const [inline, virtual] |
Estimate the number of rows satisfying the selection conditions.
The number of rows is between [nmin
, nmax
] (inclusive).
Implements ibis::table.
void ibis::tabele::estimate | ( | const ibis::qExpr * | cond, |
uint64_t & | nmin, | ||
uint64_t & | nmax | ||
) | const [inline, virtual] |
Estimate the number of rows satisfying the selection conditions.
The number of rows is between [nmin
, nmax
] (inclusive).
Implements ibis::table.
virtual int64_t ibis::tabele::getColumnAsBytes | ( | const char * | cname, |
char * | vals, | ||
uint64_t | begin = 0 , |
||
uint64_t | end = 0 |
||
) | const [inline, 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.
virtual int64_t ibis::tabele::getColumnAsDoubles | ( | const char * | cname, |
double * | vals, | ||
uint64_t | begin = 0 , |
||
uint64_t | end = 0 |
||
) | const [inline, 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.
virtual int64_t ibis::tabele::getColumnAsDoubles | ( | const char * | cname, |
std::vector< double > & | vals, | ||
uint64_t | begin = 0 , |
||
uint64_t | end = 0 |
||
) | const [inline, 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.
virtual int64_t ibis::tabele::getColumnAsFloats | ( | const char * | cname, |
float * | vals, | ||
uint64_t | begin = 0 , |
||
uint64_t | end = 0 |
||
) | const [inline, 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.
virtual int64_t ibis::tabele::getColumnAsInts | ( | const char * | cname, |
int32_t * | vals, | ||
uint64_t | begin = 0 , |
||
uint64_t | end = 0 |
||
) | const [inline, 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.
virtual int64_t ibis::tabele::getColumnAsLongs | ( | const char * | cname, |
int64_t * | vals, | ||
uint64_t | begin = 0 , |
||
uint64_t | end = 0 |
||
) | const [inline, 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.
virtual int64_t ibis::tabele::getColumnAsShorts | ( | const char * | cname, |
int16_t * | vals, | ||
uint64_t | begin = 0 , |
||
uint64_t | end = 0 |
||
) | const [inline, 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.
virtual int64_t ibis::tabele::getColumnAsStrings | ( | const char * | cname, |
std::vector< std::string > & | vals, | ||
uint64_t | begin = 0 , |
||
uint64_t | end = 0 |
||
) | const [inline, 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.
virtual int64_t ibis::tabele::getColumnAsUBytes | ( | const char * | cname, |
unsigned char * | vals, | ||
uint64_t | begin = 0 , |
||
uint64_t | end = 0 |
||
) | const [inline, 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.
virtual int64_t ibis::tabele::getColumnAsUInts | ( | const char * | cname, |
uint32_t * | vals, | ||
uint64_t | begin = 0 , |
||
uint64_t | end = 0 |
||
) | const [inline, 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.
virtual int64_t ibis::tabele::getColumnAsULongs | ( | const char * | cname, |
uint64_t * | vals, | ||
uint64_t | begin = 0 , |
||
uint64_t | end = 0 |
||
) | const [inline, 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.
virtual int64_t ibis::tabele::getColumnAsUShorts | ( | const char * | cname, |
uint16_t * | vals, | ||
uint64_t | begin = 0 , |
||
uint64_t | end = 0 |
||
) | const [inline, 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.
virtual double ibis::tabele::getColumnMax | ( | const char * | cname | ) | const [inline, 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.
virtual double ibis::tabele::getColumnMin | ( | const char * | cname | ) | const [inline, 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.
virtual long ibis::tabele::getHistogram | ( | const char * | constraints, |
const char * | cname, | ||
double | begin, | ||
double | end, | ||
double | stride, | ||
std::vector< uint32_t > & | counts | ||
) | const [inline, 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.
virtual long ibis::tabele::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 [inline, 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.
virtual long ibis::tabele::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 [inline, 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.
virtual table* ibis::tabele::groupby | ( | const stringList & | ) | const [inline, 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 table* ibis::tabele::groupby | ( | const char * | str | ) | const [inline, virtual] |
Perform a group-by operation.
The column names and operations are separated by commas.
Reimplemented from ibis::table.
virtual const char* ibis::tabele::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::tabele::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 void ibis::tabele::orderby | ( | const stringList & | ) | [inline, 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.
virtual table* ibis::tabele::select | ( | const char * | sel, |
const char * | cond | ||
) | const [inline, virtual] |
Given a set of column names and a set of selection conditions, compute another table that represents the selected values.
Implements ibis::table.
![]() |