casacore
|
Class holding a comparison part of a join condition. More...
#include <TaQLJoin.h>
Public Member Functions | |
TaQLJoin (const TENShPtr &mainNode, const TENShPtr &joinNode, const std::vector< std::shared_ptr< TaQLJoinBase > > &children) | |
~TaQLJoin () override=default | |
Int64 | findRow (const TableExprId &) override |
Find the row number in the join table for the given row in the main table. | |
![]() | |
virtual | ~TaQLJoinBase ()=default |
Static Public Member Functions | |
static std::shared_ptr< TaQLJoinBase > | createRecursive (const std::vector< TableExprNode > &mainNodes, const std::vector< TableExprNode > &joinNodes, const std::vector< rownr_t > &rows, size_t level) |
From the given level on create nested TaQLJoin nodes. | |
template<typename T > | |
static std::shared_ptr< TaQLJoinBase > | makeOptDiscrete (TableExprNodeRep &node, const std::vector< TableExprNode > &mainNodes, const std::vector< TableExprNode > &joinNodes, const std::vector< rownr_t > &rows, size_t level) |
Create nested TaQLJoin nodes for a join expression part at the given level using discrete values. | |
template<typename T > | |
static std::shared_ptr< TaQLJoinBase > | makeOptInterval (const TableExprNodeSet &set, const std::vector< TableExprNode > &mainNodes, const std::vector< TableExprNode > &joinNodes, const std::vector< rownr_t > &rows, size_t level) |
Create nested TaQLJoin nodes for a join expression part at the given level using intervals. | |
Private Attributes | |
TENShPtr | itsMainNode |
TENShPtr | itsJoinNode |
TableExprNodeSetOptBase * | itsOptSet |
std::vector< std::shared_ptr< TaQLJoinBase > > | itsChildren |
Class holding a comparison part of a join condition.
Internal
TaQLJoin holds a vector of nested TaQLJoinBase objects, one for each unique value or interval in the join table. It uses TableExprNodeSetOptBase to hold the values and the index in the vector of TaQLJoinBase objects. The data types that can be used in a join condition are the same as those supported by TableExprNodeSetOptBase; that is: integer and string for a discrete value and int, double, datetime and string for an interval. Note that in the interval case int and datetime are handled as double.
Note that at the lowest level the vector of TaQLJoinBase objects contains TaQLJoinRow objects holding the join table row number. The TaQLJoin objects at the higher levels contain the index in the vector at the next level.
The class contains static functions to build the tree given the left and right part of a comparison, where left is an expression using the main table and right using the join table. The right expression gives the values to build the tree as sketched above.
In this example the main and join table are joined on 2 condition parts. First the equality match of COL1 and IDCOL, second the interval match on TIME. Note that the NAME column from the join table are selected, thus the join is used to find the name for each row in the main table.
The join table columns may contain something like below. Thus 4 unique IDCOL values, each having 2 time intervals.
The TaQLJoin tree will consist of 3 levels. The first level handles the equality match. It consists of a single TaQLJoin object containing a vector of second level TaQLJoin objects, one for each unique IDCOL value. The second level handles the TIME match. The third level contains the row number for each IDCOL/TIME pair. Schematically:
To find the matching join table row means that first the matching IDCOL is found at level 1, thereafter at level 2 the matching interval for that IDCOL.Level 3 gives the correct row number in the join table.
Definition at line 151 of file TaQLJoin.h.
casacore::TaQLJoin::TaQLJoin | ( | const TENShPtr & | mainNode, |
const TENShPtr & | joinNode, | ||
const std::vector< std::shared_ptr< TaQLJoinBase > > & | children | ||
) |
|
overridedefault |
|
static |
From the given level on create nested TaQLJoin nodes.
It use makeOptDiscrete or makeOptInterval to create the appropriate TableExprNodeSetOptBase object.
|
overridevirtual |
Find the row number in the join table for the given row in the main table.
Implements casacore::TaQLJoinBase.
|
static |
Create nested TaQLJoin nodes for a join expression part at the given level using discrete values.
Thereafter createRecursive is called for the next level.
|
static |
Create nested TaQLJoin nodes for a join expression part at the given level using intervals.
Thereafter createRecursive is called for the next level.
|
private |
Definition at line 197 of file TaQLJoin.h.
|
private |
Definition at line 195 of file TaQLJoin.h.
|
private |
Definition at line 194 of file TaQLJoin.h.
|
private |
Definition at line 196 of file TaQLJoin.h.