An abstract query interface. More...
#include <quaere.h>
Public Member Functions | |
virtual int64_t | count () const =0 |
Compute the number of results. | |
virtual void | roughCount (uint64_t &nmin, uint64_t &nmax) const =0 |
Provide an estimate of the number of hits. | |
virtual table * | select () const =0 |
Produce a projection of the joined table. | |
virtual table * | select (const char *) const =0 |
Produce a project based on the given select clause. | |
virtual ibis::table * | select (const ibis::table::stringList &colnames) const =0 |
Produce a projection of the joined table. | |
Static Public Member Functions | |
static quaere * | create (const char *sel, const char *from, const char *where) |
Create a query object using the global datasets. | |
static quaere * | create (const char *sel, const char *from, const char *where, const ibis::partList &prts) |
Generate a query expression. | |
static quaere * | create (const ibis::part *partr, const ibis::part *parts, const char *colname, const char *condr=0, const char *conds=0, const char *sel=0) |
Specify a natural join operation. |
An abstract query interface.
It provides three key functions, specifying a query, computing the number of hits, and producing a table to represent the selection. The task of specifying a query is done with the function create. There are two functions to compute the number of results, roughCount and count, where the function roughCount produce a range to indicate the number of hits is between nmin and nmax, and the function count computes the precise number of hits.
virtual int64_t ibis::quaere::count | ( | ) | const [pure virtual] |
Compute the number of results.
This function provides the exact answer. If it fails to do so, it will return a negative number to indicate error.
Implemented in ibis::jRange, ibis::jNatural, and ibis::filter.
ibis::quaere * ibis::quaere::create | ( | const char * | sel, |
const char * | fr, | ||
const char * | wh, | ||
const ibis::partList & | prts | ||
) | [static] |
Generate a query expression.
This function takes three arguments known as the select clause, the from clause and the where clause. It expects a valid where clause, but the select clause and the from clause could be blank strings or left as nil pointers. If the select clause is undefined, the default operation is to count the number of hits. If the from clause is not specified, it will attempt to use all the data partitions stored in the prts. If the where clause is not specified, the query is assumed to select every row (following the SQL convension).
References ibis::fromClause::alias(), ibis::util::decrDouble(), ibis::compRange::dup(), ibis::whereClause::empty(), ibis::qExpr::extractTableName(), ibis::findDataset(), ibis::part::getColumn(), ibis::qExpr::getConjunctiveTerms(), ibis::whereClause::getExpr(), ibis::fromClause::getJoinCondition(), ibis::qExpr::getLeft(), ibis::qExpr::getRight(), ibis::qExpr::getTableNames(), ibis::qExpr::getType(), ibis::gVerbose, ibis::util::incrDouble(), ibis::part::name(), ibis::fromClause::realName(), ibis::math::barrel::recordVariable(), ibis::fromClause::reorderNames(), ibis::qExpr::setLeft(), ibis::qExpr::setRight(), and ibis::fromClause::size().
ibis::quaere * ibis::quaere::create | ( | const ibis::part * | partr, |
const ibis::part * | parts, | ||
const char * | colname, | ||
const char * | condr = 0 , |
||
const char * | conds = 0 , |
||
const char * | sel = 0 |
||
) | [static] |
Specify a natural join operation.
This is equivalent to SQL statement
"From partr Join parts Using(colname) Where condr And conds"
virtual void ibis::quaere::roughCount | ( | uint64_t & | nmin, |
uint64_t & | nmax | ||
) | const [pure virtual] |
Provide an estimate of the number of hits.
It never fails. In the worst case, it will simply set the minimum (nmin) to 0 and the maximum (nmax) to the maximum possible number of results.
Implemented in ibis::jRange, ibis::jNatural, and ibis::filter.
virtual table* ibis::quaere::select | ( | ) | const [pure virtual] |
Produce a projection of the joined table.
The select clause associated with the query object is evaluated. If no select clause is provided, it returns a table with no columns. This is different from having a 'count(*)' as the select clause, which produce a table with one row and one column.
Implemented in ibis::jRange, ibis::jNatural, and ibis::filter.
virtual table* ibis::quaere::select | ( | const char * | ) | const [pure virtual] |
Produce a project based on the given select clause.
The joined data table is defined by the where clause and the from clause given to the constructor of this object.
Implemented in ibis::jRange, ibis::jNatural, and ibis::filter.
virtual ibis::table* ibis::quaere::select | ( | const ibis::table::stringList & | colnames | ) | const [pure virtual] |
Produce a projection of the joined table.
This function selects values using the column names provided instead of the select clause specified when the query is constructed.
Implemented in ibis::jRange, ibis::jNatural, and ibis::filter.
![]() |