AllianceDB  0.0.1
AllianceDB is an open-source suite, including benchmarks and libs for evaluating and improving stream operation algorithms on modern hardwares.
The no partition hash join (NPJ)
Collaboration diagram for The no partition hash join (NPJ):

Classes

class  INTELLI::NPJ_thread
 The thread used by NPJ. More...
 
class  INTELLI::NPJ
 The top class package of NPJ, providing a "join function". More...
 
class  INTELLI::NPJSingle
 The top class package of single threadNPJ, providing a "join function". More...
 

Functions

void INTELLI::NPJ_thread::inlineMain ()
 The 'main' function of NPJ thread. More...
 
void INTELLI::NPJ_thread::init (TuplePtr *_ts, TuplePtr *_tr, size_t _sLen, size_t _rLen, int _cpu, MultiThreadHashTablePtr _table, BarrierPtr bar)
 THe init function. More...
 
size_t INTELLI::NPJ_thread::getResult ()
 
void INTELLI::NPJ_thread::waitBuildBar (void)
 
virtual size_t INTELLI::NPJ::join (TuplePtrQueue ts, TuplePtrQueue tr, int threads=1)
 The function to execute join. More...
 
virtual size_t INTELLI::NPJ::join (TuplePtr *ts, TuplePtr *tr, size_t tsLen, size_t trLen, int threads=1)
 The function to execute join, legacy way. More...
 
virtual size_t INTELLI::NPJ::join (TuplePtr *ts, TuplePtr tr, size_t tsLen, int threads=1)
 The function to execute join, batch of one, tuple of another. More...
 
virtual size_t INTELLI::NPJ::join (TuplePtrQueue ts, TuplePtr tr, int threads=1)
 The function to execute join, batch of one, tuple of another. More...
 
virtual size_t INTELLI::NPJSingle::join (TuplePtrQueue ts, TuplePtrQueue tr, int threads=1)
 The function to execute join. More...
 
virtual size_t INTELLI::NPJSingle::join (TuplePtr *ts, TuplePtr *tr, size_t tsLen, size_t trLen, int threads=1)
 The function to execute join, legacy way. More...
 
virtual size_t INTELLI::NPJSingle::join (TuplePtr *ts, TuplePtr tr, size_t tsLen, int threads=1)
 The function to execute join, batch of one, tuple of another. More...
 
virtual size_t INTELLI::NPJSingle::join (TuplePtrQueue ts, TuplePtr tr, int threads=1)
 The function to execute join, batch of one, tuple of another. More...
 
typedef std::shared_ptr< NPJINTELLI::NPJPtr
 
typedef std::shared_ptr< NPJSingleINTELLI::NPJSinglePtr
 
#define newNPJ()   make_shared<NPJ>()
 
#define newNPJSingle()   make_shared<NPJSingle>()
 

Detailed Description

NPJ is a parallel version of the canonical hash join algorithm. Both input relations are divided into equisized portions to be assigned to a number of threads. In the build phase, all threads populate a shared hash table with all tuples of R. After synchronization via a barrier, all threads enter the probe phase, and concurrently find matching join tuples in their assigned portions of S.

Function Documentation

◆ init()

void INTELLI::NPJ_thread::init ( TuplePtr _ts,
TuplePtr _tr,
size_t  _sLen,
size_t  _rLen,
int  _cpu,
MultiThreadHashTablePtr  _table,
BarrierPtr  bar 
)
inline

THe init function.

Parameters
_tsMemory pointer of S
_trMemory pointer of S
_sLenLength of S
_rLenLength of R
_cpuCore to bind, -1 means let OS decide
_tableThe shared pointer of hash table
barTHe barrier used for build phase

◆ inlineMain()

void INTELLI::NPJ_thread::inlineMain ( )
protectedvirtual

The 'main' function of NPJ thread.

Note
This is a re-implementation of AbstractC20Thread

Reimplemented from INTELLI::AbstractC20Thread.

◆ join() [1/8]

virtual size_t INTELLI::NPJ::join ( TuplePtr ts,
TuplePtr tr,
size_t  tsLen,
size_t  trLen,
int  threads = 1 
)
virtual

The function to execute join, legacy way.

Parameters
tsThe tuples of stream S, legacy pointer
trThe tuples of stream R, legacy pointer
tsLenThe length of S
trLenThe length of R
threadsThe parallel threads
Returns
The joined tuples
Warning
This is a legacy function, avoid using it if possible

Reimplemented from INTELLI::AbstractJoinAlgo.

◆ join() [2/8]

virtual size_t INTELLI::NPJSingle::join ( TuplePtr ts,
TuplePtr tr,
size_t  tsLen,
size_t  trLen,
int  threads = 1 
)
virtual

The function to execute join, legacy way.

Parameters
tsThe tuples of stream S, legacy pointer
trThe tuples of stream R, legacy pointer
tsLenThe length of S
trLenThe length of R
threadsThe parallel threads
Returns
The joined tuples
Warning
This is a legacy function, avoid using it if possible

Reimplemented from INTELLI::AbstractJoinAlgo.

◆ join() [3/8]

virtual size_t INTELLI::NPJ::join ( TuplePtr ts,
TuplePtr  tr,
size_t  tsLen,
int  threads = 1 
)
virtual

The function to execute join, batch of one, tuple of another.

Parameters
tsThe tuples of stream S, legacy pointer
trThe tuples of stream R, one tuple
tsLenThe length of S
threadsThe parallel threads
Returns
The joined tuples
Warning
This is a legacy function, avoid using it if possible

Reimplemented from INTELLI::AbstractJoinAlgo.

◆ join() [4/8]

virtual size_t INTELLI::NPJSingle::join ( TuplePtr ts,
TuplePtr  tr,
size_t  tsLen,
int  threads = 1 
)
virtual

The function to execute join, batch of one, tuple of another.

Parameters
tsThe tuples of stream S, legacy pointer
trThe tuples of stream R, one tuple
tsLenThe length of S
threadsThe parallel threads
Returns
The joined tuples
Warning
This is a legacy function, avoid using it if possible

Reimplemented from INTELLI::AbstractJoinAlgo.

◆ join() [5/8]

virtual size_t INTELLI::NPJ::join ( TuplePtrQueue  ts,
TuplePtr  tr,
int  threads = 1 
)
virtual

The function to execute join, batch of one, tuple of another.

Parameters
tsThe tuples of stream S
trThe tuple of stream R
threadsThe parallel threads
Returns
The joined tuples

Reimplemented from INTELLI::AbstractJoinAlgo.

◆ join() [6/8]

virtual size_t INTELLI::NPJSingle::join ( TuplePtrQueue  ts,
TuplePtr  tr,
int  threads = 1 
)
virtual

The function to execute join, batch of one, tuple of another.

Parameters
tsThe tuples of stream S
trThe tuple of stream R
threadsThe parallel threads
Returns
The joined tuples

Reimplemented from INTELLI::AbstractJoinAlgo.

◆ join() [7/8]

virtual size_t INTELLI::NPJ::join ( TuplePtrQueue  ts,
TuplePtrQueue  tr,
int  threads = 1 
)
virtual

The function to execute join.

Parameters
tsThe tuples of stream S
trThe tuples of stream R
threadsThe parallel threads
Returns
The joined tuples
Todo:
Add AMP and NUMA support in the future, so far only generic SMP

Reimplemented from INTELLI::AbstractJoinAlgo.

◆ join() [8/8]

virtual size_t INTELLI::NPJSingle::join ( TuplePtrQueue  ts,
TuplePtrQueue  tr,
int  threads = 1 
)
virtual

The function to execute join.

Parameters
tsThe tuples of stream S
trThe tuples of stream R
threadsThe parallel threads
Returns
The joined tuples
Todo:
Add AMP and NUMA support in the future, so far only generic SMP

Reimplemented from INTELLI::AbstractJoinAlgo.