An abstract query interface. More...
#include <quaere.h>
Public Member Functions | |
virtual int64_t | count () const =0 |
Compute the number of results. More... | |
virtual void | roughCount (uint64_t &nmin, uint64_t &nmax) const =0 |
Provide an estimate of the number of hits. More... | |
virtual table * | select () const =0 |
Produce a projection of the joint table. More... | |
virtual table * | select (const char *) const =0 |
Produce a project based on the given select clause. More... | |
virtual ibis::table * | select (const ibis::table::stringArray &colnames) const =0 |
Produce a projection of all known data partitions. More... | |
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. More... | |
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. More... | |
Protected Member Functions | |
quaere () | |
Default constructor. Only used by derived classes. | |
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.
|
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.
|
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::util::incrDouble(), ibis::part::name(), ibis::selectClause::parse(), ibis::fromClause::realName(), ibis::math::barrel::recordVariable(), ibis::fromClause::reorderNames(), ibis::qExpr::setLeft(), ibis::qExpr::setRight(), ibis::fromClause::size(), and ibis::selectClause::swap().
|
static |
Specify a natural join operation.
This is equivalent to SQL statement
"From partr Join parts Using(colname) Where condr And conds"
|
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.
|
pure virtual |
Produce a projection of the joint 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.
|
pure virtual |
Produce a project based on the given select clause.
The joint 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.
|
pure virtual |
Produce a projection of all known data partitions.
This function selects all values of the named columns that are not NULL.
Implemented in ibis::jRange, ibis::jNatural, and ibis::filter.