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 DynamicContext
protected static final String
protected boolean
protected boolean
protected boolean
protected boolean
protected RuntimeStaticContext
protected URI
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
RuntimeIterator
(List<RuntimeIterator> children, RuntimeStaticContext staticContext) -
Method Summary
Modifier and TypeMethodDescriptionvoid
bindToVariableInDynamicContext
(DynamicContext targetContext, Name variable, DynamicContext executionContext) boolean
Checks whether this iterator can produce valid DataFrames with no error (natively or not).void
close()
deepCopy()
generateNativeQuery
(NativeClauseContext nativeClauseContext) This function generate (if possible) a native spark-sql query that maps the inner working of the iteratorgetDataFrame
(DynamicContext context) boolean
getEffectiveBooleanValue
(DynamicContext dynamicContext) This function calculates the effective boolean value of the sequence given by iterator.boolean
getEffectiveBooleanValueOrCheckPosition
(DynamicContext dynamicContext, Item position) This function calculates the effective boolean value of the sequence given by iterator.final JSoundDataFrame
getOrCreateDataFrame
(DynamicContext context) Gets the output as a DataFrame.getPendingUpdateList
(DynamicContext context) org.apache.spark.api.java.JavaRDD<Item>
getRDD
(DynamicContext context) boolean
hasNext()
boolean
Checks whether this iterator natively produces DataFrames.boolean
isLocal()
boolean
isOpen()
boolean
isRDD()
boolean
boolean
boolean
Says whether this expression evaluation triggers a Spark job.boolean
materialize
(DynamicContext context) void
materialize
(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) void
materializeNFirstItems
(DynamicContext context, List<Item> result, int n) abstract Item
next()
void
open
(DynamicContext context) void
print
(StringBuffer buffer, int indent) void
void
read
(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) void
reset
(DynamicContext context) void
setStaticContext
(StaticContext staticContext) void
write
(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:
open
in interfaceRuntimeIteratorInterface
-
close
public void close()- Specified by:
close
in interfaceRuntimeIteratorInterface
-
reset
- Specified by:
reset
in interfaceRuntimeIteratorInterface
-
write
public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output) - Specified by:
write
in interfacecom.esotericsoftware.kryo.KryoSerializable
-
read
public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) - Specified by:
read
in interfacecom.esotericsoftware.kryo.KryoSerializable
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in 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:
next
in 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.
-