Interface CompiledPlan
-
- All Superinterfaces:
Executable
,Explainable<CompiledPlan>
@Experimental public interface CompiledPlan extends Explainable<CompiledPlan>, Executable
Represents an immutable, fully optimized, and executable entity that has been compiled from a Table & SQL API pipeline definition. It encodes operators, expressions, functions, data types, and table connectors.Every new Flink version might introduce improved optimizer rules, more efficient operators, and other changes that impact the behavior of previously defined pipelines. In order to ensure backwards compatibility and enable stateful streaming job upgrades, compiled plans can be persisted and reloaded across Flink versions. See the website documentation for more information about provided guarantees during stateful pipeline upgrades.
A plan can be compiled from a SQL query using
TableEnvironment.compilePlanSql(String)
. It can be persisted usingwriteToFile(Path, boolean)
or by manually extracting the JSON representation withasJsonString()
. A plan can be loaded back from a file or a string usingTableEnvironment.loadPlan(PlanReference)
. Instances can be executed usingExecutable.execute()
.Depending on the configuration, permanent catalog metadata (such as information about tables and functions) will be persisted in the plan as well. Anonymous/inline objects will be persisted (including schema and options) if possible or fail the compilation otherwise. For temporary objects, only the identifier is part of the plan and the object needs to be present in the session context during a restore.
Note: Plan restores assume a stable session context. Configuration, loaded modules and catalogs, and temporary objects must not change. Schema evolution and changes of function signatures are not supported.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description String
asJsonString()
Convert the plan to a JSON string representation.FlinkVersion
getFlinkVersion()
Returns the Flink version used to compile the plan.default CompiledPlan
printJsonString()
LikeasJsonString()
, but prints the result toSystem.out
.default void
writeToFile(File file)
Writes this plan to a file using the JSON representation.void
writeToFile(File file, boolean ignoreIfExists)
Writes this plan to a file using the JSON representation.default void
writeToFile(String path)
default void
writeToFile(String path, boolean ignoreIfExists)
default void
writeToFile(Path path)
default void
writeToFile(Path path, boolean ignoreIfExists)
-
Methods inherited from interface org.apache.flink.table.api.Executable
execute
-
Methods inherited from interface org.apache.flink.table.api.Explainable
explain, explain, printExplain
-
-
-
-
Method Detail
-
asJsonString
String asJsonString()
Convert the plan to a JSON string representation.
-
writeToFile
default void writeToFile(String path)
- See Also:
writeToFile(File)
-
writeToFile
default void writeToFile(String path, boolean ignoreIfExists)
- See Also:
writeToFile(File, boolean)
-
writeToFile
default void writeToFile(Path path)
- See Also:
writeToFile(File)
-
writeToFile
default void writeToFile(Path path, boolean ignoreIfExists)
- See Also:
writeToFile(File, boolean)
-
writeToFile
default void writeToFile(File file)
Writes this plan to a file using the JSON representation. This operation will fail if the file already exists, even if the content is different from this plan.- Parameters:
file
- the target file- Throws:
TableException
- if the file cannot be written.
-
writeToFile
void writeToFile(File file, boolean ignoreIfExists)
Writes this plan to a file using the JSON representation.- Parameters:
file
- the target fileignoreIfExists
- If a plan exists in the given file and this flag is set, no operation is executed and the plan is not overwritten. An exception is thrown otherwise. If this flag is not set andTableConfigOptions.PLAN_FORCE_RECOMPILE
is set, the plan file will be overwritten.- Throws:
TableException
- if the file cannot be written or ifignoreIfExists
is false and a plan already exists.
-
getFlinkVersion
FlinkVersion getFlinkVersion()
Returns the Flink version used to compile the plan.
-
printJsonString
default CompiledPlan printJsonString()
LikeasJsonString()
, but prints the result toSystem.out
.
-
-