Class BaseRootExec

java.lang.Object
org.apache.drill.exec.physical.impl.BaseRootExec
All Implemented Interfaces:
AutoCloseable, RootExec
Direct Known Subclasses:
BroadcastSenderRootExec, PartitionSenderRootExec, ScreenCreator.ScreenRoot, SingleSenderCreator.SingleSenderRootExec

public abstract class BaseRootExec extends Object implements RootExec
  • Field Details

  • Constructor Details

  • Method Details

    • next

      public final boolean next()
      Description copied from interface: RootExec
      Do the next batch of work.
      Specified by:
      next in interface RootExec
      Returns:
      Whether or not additional batches of work are necessary. False means that this fragment is done.
    • next

      public final RecordBatch.IterOutcome next(RecordBatch b)
    • innerNext

      public abstract boolean innerNext()
    • receivingFragmentFinished

      public void receivingFragmentFinished(ExecProtos.FragmentHandle handle)
      Description copied from interface: RootExec
      Inform sender that receiving fragment is finished and doesn't need any more data. This can be called multiple times (once for each downstream receiver). If all receivers are finished then a subsequent call to RootExec.next() will return false.
      Specified by:
      receivingFragmentFinished in interface RootExec
      Parameters:
      handle - The handle pointing to the downstream receiver that does not need anymore data.
    • dumpBatches

      public void dumpBatches(Throwable t)
      Description copied from interface: RootExec
      Dump failed batches' state preceded by its parent's state to logs. Invoked when there is a failure during fragment execution.
      Specified by:
      dumpBatches in interface RootExec
      Parameters:
      t - the exception thrown by an operator and which therefore records, in its stack trace, which operators were active on the stack
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • findLeaf

      public static <T> T findLeaf(List<T> dag, Throwable e)
      Given a list of operators and a stack trace, walks the stack trace and the operator list to find the leaf-most operator, which is the one that was active when the exception was thrown. Handle the cases in which no operator was active, each operator had multiple methods on the stack, or the exception was thrown in some class called by the operator.

      Not all operators leave a mark in the trace. In particular if a the call stack is only through base-class methods, then we have no way to know the actual class during the call. This is OK because the leaf methods are just pass-through operations, they are unlikely to fail.

      Type Parameters:
      T - the type of the operator. Parameterized to allow easier testing
      Parameters:
      dag - the list of operators from root-most to leaf-most
      e - the exception thrown somewhere in the operator tree
      Returns:
      the leaf-most operator, if any