Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
ibis::jRange Class Reference

In-memory Range Join. More...

#include <jrange.h>

Inheritance diagram for ibis::jRange:
ibis::quaere

Public Member Functions

virtual int64_t count () const
 Compute the number of results. More...
 
template<typename T >
ibis::tablefillResult (size_t nrows, double delta1, double delta2, const std::string &desc, const ibis::array_t< T > &rjcol, const ibis::table::typeArray &rtypes, const ibis::table::bufferArray &rbuff, const ibis::array_t< T > &sjcol, const ibis::table::typeArray &stypes, const ibis::table::bufferArray &sbuff, const ibis::table::stringArray &tcname, const std::vector< uint32_t > &tcnpos)
 Generate a table representing a range-join in memory. More...
 
 jRange (const ibis::part &partr, const ibis::part &parts, const ibis::column &colr, const ibis::column &cols, double delta1, double delta2, const ibis::qExpr *condr, const ibis::qExpr *conds, const ibis::selectClause *sel, const ibis::fromClause *frm, const char *desc)
 Constructor.
 
virtual void roughCount (uint64_t &nmin, uint64_t &nmax) const
 Estimate the number of hits. Nothing useful at this time.
 
virtual ibis::tableselect () const
 Produce a projection of the joint table. More...
 
virtual ibis::tableselect (const char *) const
 Produce a project based on the given select clause. More...
 
virtual ibis::tableselect (const ibis::table::stringArray &colnames) const
 Produce a projection of all known data partitions. More...
 
virtual ~jRange ()
 Destructor.
 

Static Protected Member Functions

template<typename T >
static tablefillResult (size_t nrows, double delta1, double delta2, const std::string &desc, const ibis::array_t< T > &rjcol, const ibis::table::typeArray &rtypes, const ibis::table::bufferArray &rbuff, const ibis::array_t< T > &sjcol, const ibis::table::typeArray &stypes, const ibis::table::bufferArray &sbuff, const ibis::table::stringArray &cnamet, const std::vector< uint32_t > &cnpos)
 

Protected Attributes

const ibis::columncolr_
 
const ibis::columncols_
 
const double delta1_
 
const double delta2_
 
std::string desc_
 
const ibis::fromClausefrm_
 
ibis::bitvector maskr_
 
ibis::bitvector masks_
 
int64_t nrows
 
array_t< uint32_t > * orderr_
 
array_t< uint32_t > * orders_
 
const ibis::partpartr_
 
const ibis::partparts_
 
const ibis::selectClausesel_
 
void * valr_
 
void * vals_
 

Additional Inherited Members

- Static Public Member Functions inherited from ibis::quaere
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 inherited from ibis::quaere
 quaere ()
 Default constructor. Only used by derived classes.
 

Detailed Description

In-memory Range Join.

A range join is a SQL query of the form

SELECT count(*) FROM partR, partS WHERE
delta1 <= partR.colR - partS.colS <= delta2
and conditions-on-partR and conditions-on-partS;

or

SELECT count(*) FROM partR, partS WHERE partR.colR between
partS.colS + delta1 and partS.colS + delta2 and
conditions-on-partR and conditions-on-partS;

where delta1 and delta2 are constants.

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 fastb.nosp@m.it-u.nosp@m.sers@.nosp@m.hpcr.nosp@m.dm.lb.nosp@m.l.go.nosp@m.v.

Member Function Documentation

int64_t ibis::jRange::count ( ) const
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.

Implements ibis::quaere.

References ibis::DOUBLE, ibis::FLOAT, ibis::INT, ibis::LONG, ibis::SHORT, ibis::util::sortMerge(), ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

template<typename T >
ibis::table* ibis::jRange::fillResult ( size_t  nrows,
double  delta1,
double  delta2,
const std::string &  desc,
const ibis::array_t< T > &  rjcol,
const ibis::table::typeArray rtypes,
const ibis::table::bufferArray rbuff,
const ibis::array_t< T > &  sjcol,
const ibis::table::typeArray stypes,
const ibis::table::bufferArray sbuff,
const ibis::table::stringArray tcname,
const std::vector< uint32_t > &  tcnpos 
)

Generate a table representing a range-join in memory.

The input to this function are values to go into the resulting table; it only needs to match the rows and fill the output table.

Note
This implementation is for elementary numberical data types only.

References ibis::table::allocateBuffer(), ibis::bord::copyValue(), ibis::table::freeBuffers(), ibis::util::ref(), ibis::util::shortName(), ibis::array_t< T >::size(), and ibis::UNKNOWN_TYPE.

ibis::table * ibis::jRange::select ( ) const
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.

Implements ibis::quaere.

References ibis::table::describe(), ibis::table::nColumns(), ibis::table::nRows(), ibis::array_t< T >::push_back(), ibis::math::barrel::recordVariable(), ibis::array_t< T >::reserve(), and ibis::util::shortName().

ibis::table * ibis::jRange::select ( const char *  ) const
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.

Implements ibis::quaere.

References ibis::selectClause::aggExpr(), ibis::selectClause::aggSize(), ibis::table::describe(), ibis::selectClause::getAggregator(), ibis::table::nColumns(), ibis::table::nRows(), ibis::array_t< T >::push_back(), ibis::math::barrel::recordVariable(), ibis::array_t< T >::reserve(), and ibis::util::shortName().

ibis::table * ibis::jRange::select ( const ibis::table::stringArray colnames) const
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.

fill the in-memory buffer

Implements ibis::quaere.

References ibis::CATEGORY, ibis::DOUBLE, ibis::FLOAT, ibis::table::freeBuffers(), ibis::category::getDictionary(), ibis::bord::column::getDictionary(), ibis::INT, ibis::LONG, ibis::util::ref(), ibis::util::reorder(), ibis::bord::column::setDictionary(), ibis::SHORT, ibis::util::shortName(), ibis::array_t< T >::size(), ibis::TEXT, ibis::column::type(), ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, ibis::UNKNOWN_TYPE, and ibis::USHORT.


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