Class RuntimeIterator

java.lang.Object
org.rumbledb.runtime.RuntimeIterator
All Implemented Interfaces:
com.esotericsoftware.kryo.KryoSerializable, Serializable, RuntimeIteratorInterface
Direct Known Subclasses:
AtMostOneItemLocalRuntimeIterator, HybridRuntimeIterator, LocalRuntimeIterator

public abstract class RuntimeIterator extends Object implements RuntimeIteratorInterface, com.esotericsoftware.kryo.KryoSerializable
See Also:
  • Field Details

    • FLOW_EXCEPTION_MESSAGE

      protected static final String FLOW_EXCEPTION_MESSAGE
      See Also:
    • hasNext

      protected transient boolean hasNext
    • isOpen

      protected transient boolean isOpen
    • isUpdating

      protected boolean isUpdating
    • isSequential

      protected transient boolean isSequential
    • children

      protected List<RuntimeIterator> children
    • currentDynamicContextForLocalExecution

      protected transient DynamicContext currentDynamicContextForLocalExecution
    • staticContext

      protected RuntimeStaticContext staticContext
    • staticURI

      protected URI staticURI
  • Constructor Details

  • Method Details

    • setStaticContext

      public void setStaticContext(StaticContext staticContext)
    • getEffectiveBooleanValueOrCheckPosition

      public boolean getEffectiveBooleanValueOrCheckPosition(DynamicContext dynamicContext, Item position)
      This function calculates the effective boolean value of the sequence given by iterator. Non-empty objects and arrays always return true. Empty sequence returns false. Singleton atomic values are evaluated to their effective boolean value. Multiple atomic values throw an exception. If the sequence is a single numeric item and a non-null position is supplied, then instead it is checked whether the numeric item is equal to the position.
      Parameters:
      dynamicContext - the dynamic context
      position - the context position, or null if none
      Returns:
      the effective boolean value.
    • getEffectiveBooleanValue

      public boolean getEffectiveBooleanValue(DynamicContext dynamicContext)
      This function calculates the effective boolean value of the sequence given by iterator. Non-empty objects and arrays always return true. Empty sequence returns false. Singleton atomic values are evaluated to their effective boolean value. Multiple atomic values throw an exception.
      Parameters:
      dynamicContext - the dynamic context
      Returns:
      the effective boolean value.
    • open

      public void open(DynamicContext context)
      Specified by:
      open in interface RuntimeIteratorInterface
    • close

      public void close()
      Specified by:
      close in interface RuntimeIteratorInterface
    • reset

      public void reset(DynamicContext context)
      Specified by:
      reset in interface RuntimeIteratorInterface
    • write

      public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output)
      Specified by:
      write in interface com.esotericsoftware.kryo.KryoSerializable
    • read

      public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input)
      Specified by:
      read in interface com.esotericsoftware.kryo.KryoSerializable
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface RuntimeIteratorInterface
    • isOpen

      public boolean isOpen()
    • getMetadata

      public ExceptionMetadata getMetadata()
    • getHighestExecutionMode

      public ExecutionMode getHighestExecutionMode()
    • getStaticType

      public SequenceType getStaticType()
    • getConfiguration

      public RumbleRuntimeConfiguration getConfiguration()
    • isRDDOrDataFrame

      public boolean isRDDOrDataFrame()
    • isRDD

      public boolean isRDD()
    • isLocal

      public boolean isLocal()
    • getRDD

      public org.apache.spark.api.java.JavaRDD<Item> getRDD(DynamicContext context)
    • isDataFrame

      public boolean isDataFrame()
      Checks whether this iterator natively produces DataFrames.
      Returns:
      true if it does, false otherwise.
    • canProduceDataFrame

      public boolean canProduceDataFrame()
      Checks whether this iterator can produce valid DataFrames with no error (natively or not).
      Returns:
      true if it can, false otherwise.
    • getDataFrame

      public JSoundDataFrame getDataFrame(DynamicContext context)
    • getOrCreateDataFrame

      public final JSoundDataFrame getOrCreateDataFrame(DynamicContext context)
      Gets the output as a DataFrame. If necessary and possible, forcibly converts the items to a DataFrame.
      Returns:
      the DataFrame.
    • isUpdating

      public boolean isUpdating()
    • getPendingUpdateList

      public PendingUpdateList getPendingUpdateList(DynamicContext context)
    • isSequential

      public boolean isSequential()
    • next

      public abstract Item next()
      Specified by:
      next in interface RuntimeIteratorInterface
    • materialize

      public List<Item> materialize(DynamicContext context)
    • materialize

      public void materialize(DynamicContext context, List<Item> result)
      Materialize the items of the iterator into the result list.
      Parameters:
      context - the dynamic context
      result - the list to materialize the items into. The list is cleared before the materialization.
    • materializeNFirstItems

      public void materializeNFirstItems(DynamicContext context, List<Item> result, int n)
    • materializeFirstItemOrNull

      public Item materializeFirstItemOrNull(DynamicContext context)
    • materializeExactlyOneItem

      public Item materializeExactlyOneItem(DynamicContext context) throws NoItemException, MoreThanOneItemException
      Throws:
      NoItemException
      MoreThanOneItemException
    • materializeAtMostOneItemOrNull

      public Item materializeAtMostOneItemOrNull(DynamicContext context) throws MoreThanOneItemException
      Throws:
      MoreThanOneItemException
    • materializeAtMostOneItemOrDefault

      public Item materializeAtMostOneItemOrDefault(DynamicContext context, Item item) throws MoreThanOneItemException
      Throws:
      MoreThanOneItemException
    • getVariableDependencies

      public Map<Name,DynamicContext.VariableDependency> getVariableDependencies()
    • printToStandardError

      public void printToStandardError()
    • print

      public void print(StringBuffer buffer, int indent)
    • bindToVariableInDynamicContext

      public void bindToVariableInDynamicContext(DynamicContext targetContext, Name variable, DynamicContext executionContext)
    • deepCopy

      public RuntimeIterator deepCopy()
    • generateNativeQuery

      public NativeClauseContext generateNativeQuery(NativeClauseContext nativeClauseContext)
      This function generate (if possible) a native spark-sql query that maps the inner working of the iterator
      Parameters:
      nativeClauseContext - context information to generate the native query
      Returns:
      a native clause context with the spark-sql native query to get an equivalent result of the iterator, or [NativeClauseContext.NoNativeQuery] if it is not possible
    • isSparkJobNeeded

      public boolean isSparkJobNeeded()
      Says whether this expression evaluation triggers a Spark job.
      Returns:
      true if the execution triggers a Spark, false otherwise, null if undetermined yet.