Class LateralJoinBatch

All Implemented Interfaces:
AutoCloseable, Iterable<VectorWrapper<?>>, LateralContract, CloseableRecordBatch, RecordBatch, VectorAccessible

public class LateralJoinBatch extends AbstractBinaryRecordBatch<LateralJoinPOP> implements LateralContract
RecordBatch implementation for the lateral join operator. Currently it's expected LATERAL to co-exists with UNNEST operator. Both LATERAL and UNNEST will share a contract with each other defined at LateralContract.
  • Constructor Details

  • Method Details

    • innerNext

      public RecordBatch.IterOutcome innerNext()
      Gets the left and right incoming batch and produce the output batch. If the left incoming batch is empty then next on right branch is not called and empty batch with correct outcome is returned. If non empty left incoming batch is received then it call's next on right branch to get an incoming and finally produces output.
      Specified by:
      innerNext in class AbstractRecordBatch<LateralJoinPOP>
      Returns:
      IterOutcome state of the lateral join batch
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Overrides:
      close in class AbstractRecordBatch<LateralJoinPOP>
    • getRecordCount

      public int getRecordCount()
      Description copied from interface: VectorAccessible
      Get the number of records.
      Specified by:
      getRecordCount in interface VectorAccessible
      Returns:
      number of records
    • getIncoming

      public RecordBatch getIncoming()
      Returns the left side incoming for the Lateral Join. Used by right branch leaf operator of Lateral to process the records at leftJoinIndex.
      Specified by:
      getIncoming in interface LateralContract
      Returns:
      - RecordBatch received as left side incoming
    • getRecordIndex

      public int getRecordIndex()
      Returns the current row index which the calling operator should process in current incoming left record batch. LATERAL should never return it as -1 since that indicated current left batch is empty and LATERAL will never call next on right side with empty left batch
      Specified by:
      getRecordIndex in interface LateralContract
      Returns:
      - int - index of row to process.
    • getLeftOutcome

      public RecordBatch.IterOutcome getLeftOutcome()
      Returns the current RecordBatch.IterOutcome for the left incoming batch
      Specified by:
      getLeftOutcome in interface LateralContract
      Returns:
      The current outcome of left incoming batch.
    • prefetchFirstBatchFromBothSides

      protected boolean prefetchFirstBatchFromBothSides()
      Get the left and right batch during build schema phase for LateralJoinBatch. If left batch sees a failure outcome then we don't even call next on right branch, since there is no left incoming.
      Overrides:
      prefetchFirstBatchFromBothSides in class AbstractBinaryRecordBatch<LateralJoinPOP>
      Returns:
      true if both the left/right batch was received without failure outcome. false if either of batch is received with failure outcome.
    • buildSchema

      protected void buildSchema()
      Prefetch a batch from left and right branch to know about the schema of each side. Then adds value vector in output container based on those schemas. For this phase LATERAL always expect's an empty batch from right side which UNNEST should abide by.
      Overrides:
      buildSchema in class AbstractRecordBatch<LateralJoinPOP>
      Throws:
      SchemaChangeException - if batch schema was changed during execution
    • cancelIncoming

      protected void cancelIncoming()
      Overrides:
      cancelIncoming in class AbstractBinaryRecordBatch<LateralJoinPOP>
    • setMaxOutputRowCount

      public void setMaxOutputRowCount(int outputRowCount)
      Used only for testing for cases when multiple output batches are produced for same input set
      Parameters:
      outputRowCount - - Max rows that output batch can hold
    • setUseMemoryManager

      public void setUseMemoryManager(boolean useMemoryManager)
      Used only for testing to disable output batch calculation using memory manager and instead use the static max value set by setMaxOutputRowCount(int)
      Parameters:
      useMemoryManager - - false - disable memory manager update to take effect, true enable memory manager update
    • dump

      public void dump()
      Description copied from interface: RecordBatch
      Perform dump of this batch's state to logs.
      Specified by:
      dump in interface RecordBatch