In-memory Range Join. More...
#include <jrange.h>
Public Member Functions | |
virtual int64_t | count () const |
Compute the number of results. | |
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::table * | select () const |
Produce a projection of the joined table. | |
virtual ibis::table * | select (const char *) const |
Produce a project based on the given select clause. | |
virtual ibis::table * | select (const ibis::table::stringList &colnames) const |
Produce a projection of the joined table. | |
virtual | ~jRange () |
Destructor. | |
Static Protected Member Functions | |
template<typename T > | |
static table * | fillResult (size_t nrows, double delta1, double delta2, const std::string &desc, const ibis::array_t< T > &rjcol, const ibis::table::typeList &rtypes, const ibis::table::bufferList &rbuff, const ibis::array_t< T > &sjcol, const ibis::table::typeList &stypes, const ibis::table::bufferList &sbuff, const ibis::table::stringList &cnamet, const std::vector< uint32_t > &cnpos) |
Generate a table representing a range-join in memory. | |
Protected Attributes | |
const ibis::column & | colr_ |
const ibis::column & | cols_ |
const double | delta1_ |
const double | delta2_ |
std::string | desc_ |
const ibis::fromClause * | frm_ |
ibis::bitvector | maskr_ |
ibis::bitvector | masks_ |
int64_t | nrows |
array_t< uint32_t > * | orderr_ |
array_t< uint32_t > * | orders_ |
const ibis::part & | partr_ |
const ibis::part & | parts_ |
const ibis::selectClause * | sel_ |
void * | valr_ |
void * | vals_ |
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.
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::BYTE, ibis::DOUBLE, ibis::FLOAT, ibis::gVerbose, ibis::INT, ibis::LONG, ibis::SHORT, ibis::util::sortMerge(), ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.
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::typeList & | rtypes, | ||
const ibis::table::bufferList & | rbuff, | ||
const ibis::array_t< T > & | sjcol, | ||
const ibis::table::typeList & | stypes, | ||
const ibis::table::bufferList & | sbuff, | ||
const ibis::table::stringList & | tcname, | ||
const std::vector< uint32_t > & | tcnpos | ||
) | [static, protected] |
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.
References ibis::table::allocateBuffer(), ibis::bord::copyValue(), ibis::table::freeBuffers(), ibis::gVerbose, 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 joined 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.
Implements ibis::quaere.
References ibis::table::describe(), ibis::gVerbose, 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 joined 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::gVerbose, 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::stringList & | colnames | ) | const [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.
fill the in-memory buffer
Implements ibis::quaere.
References ibis::BYTE, ibis::CATEGORY, ibis::DOUBLE, ibis::FLOAT, ibis::table::freeBuffers(), ibis::category::getDictionary(), ibis::bord::column::getDictionary(), ibis::gVerbose, 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.
![]() |