Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
ibis::quaere Class Referenceabstract

An abstract query interface. More...

#include <quaere.h>

Inheritance diagram for ibis::quaere:
ibis::filter ibis::jNatural ibis::jRange

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 tableselect () const =0
 Produce a projection of the joint table. More...
 
virtual tableselect (const char *) const =0
 Produce a project based on the given select clause. More...
 
virtual ibis::tableselect (const ibis::table::stringArray &colnames) const =0
 Produce a projection of all known data partitions. More...
 

Static Public Member Functions

static quaerecreate (const char *sel, const char *from, const char *where)
 Create a query object using the global datasets.
 
static quaerecreate (const char *sel, const char *from, const char *where, const ibis::partList &prts)
 Generate a query expression. More...
 
static quaerecreate (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.
 

Detailed Description

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.

Warning
This is an experimental feature of FastBit. The current design is very limited and is likely to go through major revisions frequently. Feel free to express your opinions about the design of this class on the FastBit mailing list fastb.nosp@m.it-u.nosp@m.sers@.nosp@m.hpcr.nosp@m.dm.lb.nosp@m.l.go.nosp@m.v.
Note
The word quaere is the latin equivalent of query. Once the implementation of this class stablizes, we intend to swap the names quaere and query.

Member Function Documentation

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

Note
If more than one data partition was used in specifying the query, the column names should be fully qualified in the form of "part-name.column-name". If a dot ('.') is not present or the string before the dot is not the name of a data partition, the whole string is taken to be a column name. In which case, the lookup proceeds from the list of data partitions one at a time. A nil pointer will be returned if any name is not associated with a known column.

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

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"

Note
Conditions specified in condr is for partr only, and conds is for parts only. If no conditions are specified, all valid records in the partition will participate in the natural join.
The select clause should have fully qualified column names. Unqualified column names will assumed to be searched in partr first and then in parts.
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 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.

Note
We assume that this query object might be reused later and therefore store partial results associated with the query object.

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

virtual ibis::table* ibis::quaere::select ( const ibis::table::stringArray colnames) const
pure virtual

Produce a projection of all known data partitions.

This function selects all values of the named columns that are not NULL.

Note
This function assumes that this query object is used only once and therefore does not cache the results.

Implemented in ibis::jRange, ibis::jNatural, and ibis::filter.


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