Interface CompiledPlan
- All Superinterfaces:
Executable,Explainable<CompiledPlan>
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 using writeToFile(Path, boolean) or by manually extracting the JSON
representation with asJsonString(). A plan can be loaded back from a file or a string
using TableEnvironment.loadPlan(PlanReference). Instances can be executed using Executable.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
Modifier and TypeMethodDescriptionConvert the plan to a JSON string representation.org.apache.flink.FlinkVersionReturns the Flink version used to compile the plan.default CompiledPlanLikeasJsonString(), but prints the result toSystem.out.default voidwriteToFile(File file) Writes this plan to a file using the JSON representation.voidwriteToFile(File file, boolean ignoreIfExists) Writes this plan to a file using the JSON representation.default voidwriteToFile(String path) default voidwriteToFile(String path, boolean ignoreIfExists) default voidwriteToFile(Path path) default voidwriteToFile(Path path, boolean ignoreIfExists) Methods inherited from interface org.apache.flink.table.api.Executable
executeMethods inherited from interface org.apache.flink.table.api.Explainable
explain, explain, printExplain
-
Method Details
-
asJsonString
String asJsonString()Convert the plan to a JSON string representation. -
writeToFile
- See Also:
-
writeToFile
- See Also:
-
writeToFile
- See Also:
-
writeToFile
- See Also:
-
writeToFile
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:
org.apache.flink.table.api.TableException- if the file cannot be written.
-
writeToFile
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_RECOMPILEis set, the plan file will be overwritten.- Throws:
org.apache.flink.table.api.TableException- if the file cannot be written or ifignoreIfExistsis false and a plan already exists.
-
getFlinkVersion
org.apache.flink.FlinkVersion getFlinkVersion()Returns the Flink version used to compile the plan. -
printJsonString
LikeasJsonString(), but prints the result toSystem.out.
-