Package org.rumbledb.runtime.plan
Class RuntimePlan<T>
java.lang.Object
org.rumbledb.runtime.plan.RuntimePlan<T>
- Type Parameters:
T- the logical value produced by this plan
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ItemRuntimePlan,TupleRuntimePlan
Immutable, reusable description of a runtime computation.
A plan may be shared by multiple evaluations. Mutable state belonging to one local evaluation must be kept in the
Cursor returned by a LocalRuntimePlan, never in the plan.
A plan implements LocalRuntimePlan, RDDRuntimePlan, or DataFrameRuntimePlan for every
representation it supports natively. The compiled execution mode expresses the preferred representation. The plan
selects the closest supported native representation, and conversion to a representation requested by a caller
happens only after that selection.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final RumbleConfigurationgetCursor(@NonNull DynamicContext context) Executes this plan in its selected native representation and exposes the result as a cursor.final RuntimeDataFrame<T>getDataFrame(@NonNull DynamicContext context) Executes this plan in its selected native representation and exposes the result as a typed runtime DataFrame.protected final ExceptionMetadatafinal org.apache.spark.api.java.JavaRDD<T>getRDD(@NonNull DynamicContext context) Returns this plan as an RDD, executing its selected native representation first and converting only at this boundary.final RuntimeStaticContextReturns the immutable static context determined while compiling this plan.materialize(@NonNull DynamicContext context) Evaluates this plan locally and materializes every result.materializeAtMost(@NonNull DynamicContext context, int limit) Evaluates this plan locally and materializes no more thanlimitresults.final TmaterializeAtMostOne(@NonNull DynamicContext context) Evaluates this plan locally and returns its only result, ornullfor an empty sequence.final TmaterializeExactlyOne(@NonNull DynamicContext context) Evaluates this plan and returns its only result.final TmaterializeFirstOrNull(@NonNull DynamicContext context) Evaluates this plan locally and returns its first result, ornullfor an empty sequence.
-
Field Details
-
staticContext
-
-
Constructor Details
-
RuntimePlan
-
-
Method Details
-
getMetadata
-
getConfiguration
-
getCursor
Executes this plan in its selected native representation and exposes the result as a cursor. -
getRDD
Returns this plan as an RDD, executing its selected native representation first and converting only at this boundary. -
getDataFrame
Executes this plan in its selected native representation and exposes the result as a typed runtime DataFrame. -
materialize
Evaluates this plan locally and materializes every result.- Parameters:
context- the dynamic context for the evaluation- Returns:
- the materialized result sequence
-
materializeFirstOrNull
Evaluates this plan locally and returns its first result, ornullfor an empty sequence.- Parameters:
context- the dynamic context for the evaluation- Returns:
- the first result, or
null
-
materializeAtMost
Evaluates this plan locally and materializes no more thanlimitresults.- Parameters:
context- the dynamic context for the evaluationlimit- the maximum number of results to materialize
-
materializeAtMostOne
public final T materializeAtMostOne(@NonNull @NonNull DynamicContext context) throws MoreThanOneItemException Evaluates this plan locally and returns its only result, ornullfor an empty sequence.- Parameters:
context- the dynamic context for the evaluation- Returns:
- the only result, or
null - Throws:
MoreThanOneItemException- if more than one result is produced
-
materializeExactlyOne
public final T materializeExactlyOne(@NonNull @NonNull DynamicContext context) throws NoItemException, MoreThanOneItemException Evaluates this plan and returns its only result.- Parameters:
context- the dynamic context for the evaluation- Returns:
- the only result
- Throws:
NoItemException- if the plan produces no resultMoreThanOneItemException- if the plan produces more than one result
-
getRuntimeStaticContext
Returns the immutable static context determined while compiling this plan.- Returns:
- the non-null runtime static context
-