Public Member Functions | Static Public Member Functions
ibis::quaere Class Reference

An abstract query interface. More...

#include <quaere.h>

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

List of all members.

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 ibis::tableselect (const ibis::table::stringList &colnames) const =0
 Produce a projection of the joined table.
virtual tableselect () const =0
 Produce a projection of the joined table.

Static Public Member Functions

static quaerecreate (const char *sel, const char *from, const char *where)
 Generate a query expression.
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)
 A natural join.

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 on the FastBit mailing list fastbit-users@hpcrdm.lbl.gov.
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::filter, ibis::jNatural, and ibis::jRange.

ibis::quaere * ibis::quaere::create ( const char *  sel,
const char *  fr,
const char *  wh 
) [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 global variable ibis::datasets.

References ibis::fromClause::alias(), ibis::datasets, ibis::util::decrDouble(), ibis::compRange::dup(), ibis::selectClause::empty(), 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::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]

A natural join.

Specify a natural join operation.

This is equivalent to SQL statement

"From partr Join parts Using(colname) Where condr And conds"

Note 1: 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.

Note 2: 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::filter, ibis::jNatural, and ibis::jRange.

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

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


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