Class JoinTemplate

java.lang.Object
org.apache.drill.exec.physical.impl.join.JoinTemplate
All Implemented Interfaces:
JoinWorker

public abstract class JoinTemplate extends Object implements JoinWorker
Merge Join implementation using RecordIterator.
  • Constructor Details

    • JoinTemplate

      public JoinTemplate()
  • Method Details

    • setupJoin

      public void setupJoin(FragmentContext context, JoinStatus status, VectorContainer outgoing) throws SchemaChangeException
      Specified by:
      setupJoin in interface JoinWorker
      Throws:
      SchemaChangeException
    • doJoin

      public final boolean doJoin(JoinStatus status)
      Copy rows from the input record batches until the output record batch is full
      Specified by:
      doJoin in interface JoinWorker
      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 SV4
      outIndex - 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