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 ibis::table::stringList &colnames) const |
Produce a projection of the joined table. | |
virtual ibis::table * | select () 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 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. 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.
fill the in-memory buffer
Implements ibis::quaere.
References ibis::BYTE, ibis::CATEGORY, ibis::DOUBLE, ibis::FLOAT, ibis::table::freeBuffers(), ibis::gVerbose, ibis::INT, ibis::LONG, ibis::util::ref(), ibis::util::reorder(), ibis::SHORT, ibis::util::shortName(), ibis::array_t< T >::size(), ibis::TEXT, ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, ibis::UNKNOWN_TYPE, and ibis::USHORT.
![]() |