Package org.rumbledb.runtime
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 Summary
FieldsModifier and TypeFieldDescriptionprotected List<RuntimeIterator>protected DynamicContextprotected static final Stringprotected booleanprotected booleanprotected booleanprotected booleanprotected RuntimeStaticContextprotected URI -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRuntimeIterator(List<RuntimeIterator> children, RuntimeStaticContext staticContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidbindToVariableInDynamicContext(DynamicContext targetContext, Name variable, DynamicContext executionContext) booleanChecks whether this iterator can produce valid DataFrames with no error (natively or not).voidclose()deepCopy()generateNativeQuery(NativeClauseContext nativeClauseContext) This function generate (if possible) a native spark-sql query that maps the inner working of the iteratorgetDataFrame(DynamicContext context) booleangetEffectiveBooleanValue(DynamicContext dynamicContext) This function calculates the effective boolean value of the sequence given by iterator.booleangetEffectiveBooleanValueOrCheckPosition(DynamicContext dynamicContext, Item position) This function calculates the effective boolean value of the sequence given by iterator.final JSoundDataFramegetOrCreateDataFrame(DynamicContext context) Gets the output as a DataFrame.getPendingUpdateList(DynamicContext context) org.apache.spark.api.java.JavaRDD<Item>getRDD(DynamicContext context) booleanhasNext()booleanChecks whether this iterator natively produces DataFrames.booleanisLocal()booleanisOpen()booleanisRDD()booleanbooleanbooleanSays whether this expression evaluation triggers a Spark job.booleanmaterialize(DynamicContext context) voidmaterialize(DynamicContext context, List<Item> result) Materialize the items of the iterator into the result list.materializeAtMostOneItemOrDefault(DynamicContext context, Item item) materializeExactlyOneItem(DynamicContext context) materializeFirstItemOrNull(DynamicContext context) voidmaterializeNFirstItems(DynamicContext context, List<Item> result, int n) abstract Itemnext()voidopen(DynamicContext context) voidprint(StringBuffer buffer, int indent) voidvoidread(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) voidreset(DynamicContext context) voidsetStaticContext(StaticContext staticContext) voidwrite(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output)
-
Field Details
-
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
-
currentDynamicContextForLocalExecution
-
staticContext
-
staticURI
-
-
Constructor Details
-
RuntimeIterator
-
-
Method Details
-
setStaticContext
-
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 contextposition- the context position, or null if none- Returns:
- the effective boolean value.
-
getEffectiveBooleanValue
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
- Specified by:
openin interfaceRuntimeIteratorInterface
-
close
public void close()- Specified by:
closein interfaceRuntimeIteratorInterface
-
reset
- Specified by:
resetin interfaceRuntimeIteratorInterface
-
write
public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output) - Specified by:
writein interfacecom.esotericsoftware.kryo.KryoSerializable
-
read
public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) - Specified by:
readin interfacecom.esotericsoftware.kryo.KryoSerializable
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceRuntimeIteratorInterface
-
isOpen
public boolean isOpen() -
getMetadata
-
getHighestExecutionMode
-
getStaticType
-
getConfiguration
-
isRDDOrDataFrame
public boolean isRDDOrDataFrame() -
isRDD
public boolean isRDD() -
isLocal
public boolean isLocal() -
getRDD
-
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
-
getOrCreateDataFrame
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
-
isSequential
public boolean isSequential() -
next
- Specified by:
nextin interfaceRuntimeIteratorInterface
-
materialize
-
materialize
Materialize the items of the iterator into the result list.- Parameters:
context- the dynamic contextresult- the list to materialize the items into. The list is cleared before the materialization.
-
materializeNFirstItems
-
materializeFirstItemOrNull
-
materializeExactlyOneItem
public Item materializeExactlyOneItem(DynamicContext context) throws NoItemException, MoreThanOneItemException -
materializeAtMostOneItemOrNull
- Throws:
MoreThanOneItemException
-
materializeAtMostOneItemOrDefault
public Item materializeAtMostOneItemOrDefault(DynamicContext context, Item item) throws MoreThanOneItemException - Throws:
MoreThanOneItemException
-
getVariableDependencies
-
printToStandardError
public void printToStandardError() -
print
-
bindToVariableInDynamicContext
public void bindToVariableInDynamicContext(DynamicContext targetContext, Name variable, DynamicContext executionContext) -
deepCopy
-
generateNativeQuery
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.
-