Class JoinTemplate
java.lang.Object
org.apache.drill.exec.physical.impl.join.JoinTemplate
- All Implemented Interfaces:
JoinWorker
Merge Join implementation using RecordIterator.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.drill.exec.physical.impl.join.JoinWorker
JoinWorker.JoinOutcome
-
Field Summary
Fields inherited from interface org.apache.drill.exec.physical.impl.join.JoinWorker
TEMPLATE_DEFINITION
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract int
doCompare
(int leftIndex, int rightIndex) Compare the values of the left and right join key to determine whether the left is less than, greater than or equal to the right.abstract void
doCopyLeft
(int leftIndex, int outIndex) Copy the data to the new record batch (if it fits).abstract void
doCopyRight
(int rightIndex, int outIndex) final boolean
doJoin
(JoinStatus status) Copy rows from the input record batches until the output record batch is fullabstract void
doSetup
(FragmentContext context, JoinStatus status, VectorContainer outgoing) void
setupJoin
(FragmentContext context, JoinStatus status, VectorContainer outgoing)
-
Constructor Details
-
JoinTemplate
public JoinTemplate()
-
-
Method Details
-
setupJoin
public void setupJoin(FragmentContext context, JoinStatus status, VectorContainer outgoing) throws SchemaChangeException - Specified by:
setupJoin
in interfaceJoinWorker
- Throws:
SchemaChangeException
-
doJoin
Copy rows from the input record batches until the output record batch is full- Specified by:
doJoin
in interfaceJoinWorker
- Parameters:
status
- State of the join operation (persists across multiple record batches/schema changes)- Returns:
- true of join succeeded; false if the worker needs to be regenerated
-
doSetup
public abstract void doSetup(@Named("context") FragmentContext context, @Named("status") JoinStatus status, @Named("outgoing") VectorContainer outgoing) throws SchemaChangeException - Throws:
SchemaChangeException
-
doCopyLeft
public abstract void doCopyLeft(@Named("leftIndex") int leftIndex, @Named("outIndex") int outIndex) Copy the data to the new record batch (if it fits).- Parameters:
leftIndex
- position of batch (lower 16 bits) and record (upper 16 bits) in left SV4outIndex
- position of the output record batch
-
doCopyRight
public abstract void doCopyRight(@Named("rightIndex") int rightIndex, @Named("outIndex") int outIndex) -
doCompare
protected abstract int doCompare(@Named("leftIndex") int leftIndex, @Named("rightIndex") int rightIndex) Compare the values of the left and right join key to determine whether the left is less than, greater than or equal to the right.- Parameters:
leftIndex
-rightIndex
-- Returns:
- 0 if both keys are equal -1 if left is < right 1 if left is > right
-