Class ResultSetCopierImpl

java.lang.Object
org.apache.drill.exec.physical.resultSet.impl.ResultSetCopierImpl
All Implemented Interfaces:
ResultSetCopier

public class ResultSetCopierImpl extends Object implements ResultSetCopier
  • Field Details

  • Constructor Details

  • Method Details

    • startOutputBatch

      public void startOutputBatch()
      Description copied from interface: ResultSetCopier
      Start the next output batch.
      Specified by:
      startOutputBatch in interface ResultSetCopier
    • nextInputBatch

      public boolean nextInputBatch()
      Description copied from interface: ResultSetCopier
      Start the next input batch. The input batch must be held by the ResultSetReader passed into the constructor.
      Specified by:
      nextInputBatch in interface ResultSetCopier
    • hasOutputRows

      public boolean hasOutputRows()
      Description copied from interface: ResultSetCopier
      Reports if the output batch has rows. Useful after the end of input to determine if a partial output batch exists to send downstream.
      Specified by:
      hasOutputRows in interface ResultSetCopier
      Returns:
      true if the output batch has one or more rows
    • isOutputFull

      public boolean isOutputFull()
      Description copied from interface: ResultSetCopier
      Reports if the output batch is full and must be sent downstream. The output batch can be full in the middle of a copy, in which case ResultSetCopier.isCopyPending() will also return true.

      This function also returns true if a schema change occurred on the latest input row, in which case the partially-completed batch of the old schema must be flushed downstream.

      Specified by:
      isOutputFull in interface ResultSetCopier
      Returns:
      true if the output is full and must be harvested and sent downstream
    • verifyWritable

      protected void verifyWritable()
    • copyNextRow

      public boolean copyNextRow()
      Description copied from interface: ResultSetCopier
      If copying rows one by one, copy the next row from the input.
      Specified by:
      copyNextRow in interface ResultSetCopier
      Returns:
      true if more rows remain on the input, false if all rows are exhausted
    • copyRow

      public void copyRow(int posn)
      Description copied from interface: ResultSetCopier
      Copy a row at the given position. For those cases in which random copying is needed, but a selection vector is not available. Note that this version is slow because of the need to reset indexes for every row. Better to use a selection vector, then copy sequentially.
      Specified by:
      copyRow in interface ResultSetCopier
      Parameters:
      posn - the input row position. If a selection vector is attached, then this is the selection vector position
    • copyAllRows

      public void copyAllRows()
      Description copied from interface: ResultSetCopier
      Copy all (remaining) input rows to the output. If insufficient space exists in the output, does a partial copy, and ResultSetCopier.isCopyPending() will return true.
      Specified by:
      copyAllRows in interface ResultSetCopier
    • isCopyPending

      public boolean isCopyPending()
      Description copied from interface: ResultSetCopier
      Helper method to determine if a copy is pending: more rows remain to be copied. If so, start a new output batch, which will finish the copy. Do that before start a new input batch.
      Specified by:
      isCopyPending in interface ResultSetCopier
      Returns:
    • harvest

      public VectorContainer harvest()
      Description copied from interface: ResultSetCopier
      Obtain the output batch. Returned as a vector container since the output will not have a selection vector.
      Specified by:
      harvest in interface ResultSetCopier
      Returns:
      a vector container holding the output batch
    • close

      public void close()
      Description copied from interface: ResultSetCopier
      Release resources, including any pending input batch and any non-harvested output batch.
      Specified by:
      close in interface ResultSetCopier