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

In-memory Natual Join. More...

#include <jnatural.h>

Inheritance diagram for ibis::jNatural:
ibis::quaere

Public Member Functions

virtual int64_t count () const
 Use sort-merge join. More...
 
template<typename T >
ibis::tablefillResult (size_t nrows, 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 an equi-join in memory. More...
 
 jNatural (const ibis::part *partr, const ibis::part *parts, const char *colname, const char *condr, const char *conds, const char *sel)
 Constructor. More...
 
 jNatural (const ibis::part *partr, const ibis::part *parts, const ibis::column *colr, const ibis::column *cols, const ibis::qExpr *condr, const ibis::qExpr *conds, const ibis::selectClause *sel, const ibis::fromClause *frm, const char *desc)
 Constructor. More...
 
virtual void roughCount (uint64_t &nmin, uint64_t &nmax) const
 Estimate the number of hits. Don't do much right now, may change later.
 
virtual ibis::tableselect () const
 Evaluate the select clause specified in the constructor.
 
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
 Select values for a list of column names. More...
 

Static Protected Member Functions

template<typename T >
static tablefillResult (size_t nrows, 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)
 
static tablefillResult (size_t nrows, const std::string &desc, const std::vector< std::string > &rjcol, const ibis::table::typeArray &rtypes, const ibis::table::bufferArray &rbuff, const std::vector< std::string > &sjcol, const ibis::table::typeArray &stypes, const ibis::table::bufferArray &sbuff, const ibis::table::stringArray &cnamet, const std::vector< uint32_t > &cnpos)
 Form the joined table for string valued join columns. More...
 

Protected Attributes

const ibis::columncolR_
 
const ibis::columncolS_
 
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::partR_
 
const ibis::partS_
 
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 Natual Join.

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.

Constructor & Destructor Documentation

ibis::jNatural::jNatural ( const ibis::part partr,
const ibis::part parts,
const char *  colname,
const char *  condr,
const char *  conds,
const char *  sel 
)

Constructor.

This constructor handles a join equivalent to the following SQL statement

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

Note that conditions specified in condr is for partr only, and conds is for parts only. When the column names in these conditions contain table names, the table names in them are ignored. If no conditions are specified, all valid records in the partition will participate in the natural join. This constructor avoids the need of specifying an alias when performing self-join, however, it also makes it impossible to distingush the column names in the select clause.

References ibis::bitvector::copy(), ibis::countQuery::evaluate(), ibis::countQuery::getHitVector(), ibis::column::getNullMask(), ibis::countQuery::getWhereClause(), ibis::part::name(), ibis::countQuery::setWhereClause(), ibis::column::type(), and ibis::TYPESTRING.

ibis::jNatural::jNatural ( const ibis::part partr,
const ibis::part parts,
const ibis::column colr,
const ibis::column cols,
const ibis::qExpr condr,
const ibis::qExpr conds,
const ibis::selectClause sel,
const ibis::fromClause frm,
const char *  desc 
)

Constructor.

This constructor handles a join expression equivalent to one of the following SQL statements

From partr Join parts On colr = cols where condr and conds;
From partr, parts where partr.colr = parts.cols and condr and conds;

Note that this function processes the selection conditions on partr and parts immediately and therefore does not actually remember the conditions condr and conds. To preserve those conditions, it is recommended to keep the original query string as the description desc.

References ibis::bitvector::copy(), ibis::countQuery::evaluate(), ibis::countQuery::getHitVector(), ibis::column::getNullMask(), ibis::countQuery::getWhereClause(), ibis::part::name(), ibis::column::name(), and ibis::countQuery::setWhereClause().

Member Function Documentation

int64_t ibis::jNatural::count ( ) const
virtual

Use sort-merge join.

This function sorts the qualified values and counts the number of results.

Implements ibis::quaere.

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

ibis::table * ibis::jNatural::fillResult ( size_t  nrows,
const std::string &  desc,
const std::vector< std::string > &  rjcol,
const ibis::table::typeArray rtypes,
const ibis::table::bufferArray rbuff,
const std::vector< std::string > &  sjcol,
const ibis::table::typeArray stypes,
const ibis::table::bufferArray sbuff,
const ibis::table::stringArray tcname,
const std::vector< uint32_t > &  tcnpos 
)
staticprotected

Form the joined table for string valued join columns.

The caller provides all relevant values, this function only needs to join them to produce the output data table.

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.

template<typename T >
ibis::table* ibis::jNatural::fillResult ( size_t  nrows,
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 an equi-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.

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::jNatural::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::jNatural::select ( const ibis::table::stringArray colnames) const
virtual

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