Class ExecOpSymmetricHashJoin
java.lang.Object
se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BaseForExecOps
se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BinaryExecutableOpBase
se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.ExecOpSymmetricHashJoin
- All Implemented Interfaces:
StatsProvider
,BinaryExecutableOp
,ExecutableOperator
Implementation of the symmetric hash join algorithm. This algorithm
continuously builds two hash tables (one for each of the two inputs)
and, at the same time, uses these hash tables to find join partners
for solution mappings that arrive at the respective other input. More
specifically, whenever a solution mappings appears at one of the inputs,
it is added into the hash table for that input (using the value(s) that
it has for the join variable(s) to decide where to place it in the hash
table) and then the other hash table is probed for join partners (which
must have arrived at the other input before the current solution mapping
arrived at its input.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected boolean
protected final SolutionMappingsIndex
protected final SolutionMappingsIndex
protected Stats
protected Stats
Fields inherited from class se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BinaryExecutableOpBase
timeAtCurrentLeftProcStart, timeAtCurrentRightProcStart
Fields inherited from class se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BaseForExecOps
collectExceptions
-
Constructor Summary
ConstructorsConstructorDescriptionExecOpSymmetricHashJoin
(ExpectedVariables inputVars1, ExpectedVariables inputVars2, boolean collectExceptions) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
_processInputFromChild1
(List<SolutionMapping> inputSolMaps, IntermediateResultElementSink sink, ExecutionContext execCxt) Processes the input solution mappings of the given list by callingBinaryExecutableOpBase._processInputFromChild1(SolutionMapping, IntermediateResultElementSink, ExecutionContext)
for each of them.protected void
_processInputFromChild1
(SolutionMapping inputSolMap, IntermediateResultElementSink sink, ExecutionContext execCxt) Implementations of this function need to process the given solution mapping as input coming from the first operand and send the produced result elements (if any) to the given sink.protected void
_processInputFromChild2
(List<SolutionMapping> inputSolMaps, IntermediateResultElementSink sink, ExecutionContext execCxt) Processes the input solution mappings of the given list by callingBinaryExecutableOpBase._processInputFromChild2(SolutionMapping, IntermediateResultElementSink, ExecutionContext)
for each of them.protected void
_processInputFromChild2
(SolutionMapping inputSolMap, IntermediateResultElementSink sink, ExecutionContext execCxt) Implementations of this function need to process the given solution mapping as input coming from the second operand and send the produced result elements (if any) to the given sink.protected static void
_processInputSolMap
(SolutionMapping inputSolMap, SolutionMappingsIndex indexForInput, SolutionMappingsIndex indexForProbing, List<SolutionMapping> outputBuffer) protected void
_wrapUpForChild1
(IntermediateResultElementSink sink, ExecutionContext execCxt) Implementations of this function need to finish up any processing related to the input coming from the first operand and send the remaining result elements (if any) to the given sink.protected void
_wrapUpForChild2
(IntermediateResultElementSink sink, ExecutionContext execCxt) Implementations of this function need to finish up any processing related to the input coming from the second operand and send the remaining result elements (if any) to the given sink.protected ExecutableOperatorStatsImpl
boolean
Returns true if this operator is implemented based on the assumption that the COMPLETE input from the first operand has been sent to it before input from the second operand is sent.void
protected void
wrapUp()
Methods inherited from class se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BinaryExecutableOpBase
getStats, processInputFromChild1, processInputFromChild1, processInputFromChild2, processInputFromChild2, wrapUpForChild1, wrapUpForChild2
Methods inherited from class se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BaseForExecOps
getExceptionsCaughtDuringExecution, recordExceptionCaughtDuringExecution
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface se.liu.ida.hefquin.engine.queryplan.executable.ExecutableOperator
getExceptionsCaughtDuringExecution
-
Field Details
-
indexForChild1
-
indexForChild2
-
statsOfIndexForChild1
-
statsOfIndexForChild2
-
child1InputComplete
protected boolean child1InputComplete -
child2InputComplete
protected boolean child2InputComplete
-
-
Constructor Details
-
ExecOpSymmetricHashJoin
public ExecOpSymmetricHashJoin(ExpectedVariables inputVars1, ExpectedVariables inputVars2, boolean collectExceptions)
-
-
Method Details
-
requiresCompleteChild1InputFirst
public boolean requiresCompleteChild1InputFirst()Description copied from interface:BinaryExecutableOp
Returns true if this operator is implemented based on the assumption that the COMPLETE input from the first operand has been sent to it before input from the second operand is sent. An example of an operator that may return true here is a hash join (which first needs to add all result elements from the first operand into its hash table and, then, can start consuming the result elements from the second operand by probing into the hash table). In contrast, a symmetric hash join (which has two hash tables and can consume result elements from both inputs in any order) would return false. Operators that return true here may throw anIllegalStateException
if their methodsinvalid reference
#processBlockFromChild2(IntermediateResultBlock, IntermediateResultElementSink, ExecutionContext)
BinaryExecutableOp.wrapUpForChild2(IntermediateResultElementSink, ExecutionContext)
are called beforeBinaryExecutableOp.wrapUpForChild1(IntermediateResultElementSink, ExecutionContext)
has been called. -
_processInputFromChild1
protected void _processInputFromChild1(SolutionMapping inputSolMap, IntermediateResultElementSink sink, ExecutionContext execCxt) Description copied from class:BinaryExecutableOpBase
Implementations of this function need to process the given solution mapping as input coming from the first operand and send the produced result elements (if any) to the given sink. If an exception occurs while processing the solution mapping, then this exception needs to be thrown.- Specified by:
_processInputFromChild1
in classBinaryExecutableOpBase
-
_processInputFromChild1
protected void _processInputFromChild1(List<SolutionMapping> inputSolMaps, IntermediateResultElementSink sink, ExecutionContext execCxt) Description copied from class:BinaryExecutableOpBase
Processes the input solution mappings of the given list by callingBinaryExecutableOpBase._processInputFromChild1(SolutionMapping, IntermediateResultElementSink, ExecutionContext)
for each of them. Subclasses may override this behavior to send a greater number of output solution mappings to the given sink at a time (which is useful to reduce the communication between threads in the push-based execution model). If an exception occurs within the overriding implementation, then this exception needs to be thrown.- Overrides:
_processInputFromChild1
in classBinaryExecutableOpBase
-
_wrapUpForChild1
Description copied from class:BinaryExecutableOpBase
Implementations of this function need to finish up any processing related to the input coming from the first operand and send the remaining result elements (if any) to the given sink. If an exception occurs during this process, then this exception needs to be thrown.- Specified by:
_wrapUpForChild1
in classBinaryExecutableOpBase
-
_processInputFromChild2
protected void _processInputFromChild2(SolutionMapping inputSolMap, IntermediateResultElementSink sink, ExecutionContext execCxt) Description copied from class:BinaryExecutableOpBase
Implementations of this function need to process the given solution mapping as input coming from the second operand and send the produced result elements (if any) to the given sink. If an exception occurs while processing the solution mapping, then this exception needs to be thrown. May throw anIllegalStateException
for operators for whichBinaryExecutableOp.requiresCompleteChild1InputFirst()
returns true andBinaryExecutableOpBase._wrapUpForChild1(IntermediateResultElementSink, ExecutionContext)
has not been called yet.- Specified by:
_processInputFromChild2
in classBinaryExecutableOpBase
-
_processInputFromChild2
protected void _processInputFromChild2(List<SolutionMapping> inputSolMaps, IntermediateResultElementSink sink, ExecutionContext execCxt) Description copied from class:BinaryExecutableOpBase
Processes the input solution mappings of the given list by callingBinaryExecutableOpBase._processInputFromChild2(SolutionMapping, IntermediateResultElementSink, ExecutionContext)
for each of them. Subclasses may override this behavior to send a greater number of output solution mappings to the given sink at a time (which is useful to reduce the communication between threads in the push-based execution model). If an exception occurs within the overriding implementation, then this exception needs to be thrown.- Overrides:
_processInputFromChild2
in classBinaryExecutableOpBase
-
_wrapUpForChild2
Description copied from class:BinaryExecutableOpBase
Implementations of this function need to finish up any processing related to the input coming from the second operand and send the remaining result elements (if any) to the given sink. If an exception occurs during this process, then this exception needs to be thrown. May throw anIllegalStateException
for operators for whichBinaryExecutableOp.requiresCompleteChild1InputFirst()
returns true andBinaryExecutableOpBase._wrapUpForChild1(IntermediateResultElementSink, ExecutionContext)
has not been called yet.- Specified by:
_wrapUpForChild2
in classBinaryExecutableOpBase
-
wrapUp
protected void wrapUp() -
resetStats
public void resetStats()- Specified by:
resetStats
in interfaceStatsProvider
- Overrides:
resetStats
in classBinaryExecutableOpBase
-
createStats
- Overrides:
createStats
in classBinaryExecutableOpBase
-
_processInputSolMap
protected static void _processInputSolMap(SolutionMapping inputSolMap, SolutionMappingsIndex indexForInput, SolutionMappingsIndex indexForProbing, List<SolutionMapping> outputBuffer)
-