|
| 1 | +.. ################################################################################ |
| 2 | + Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + or more contributor license agreements. See the NOTICE file |
| 4 | + distributed with this work for additional information |
| 5 | + regarding copyright ownership. The ASF licenses this file |
| 6 | + to you under the Apache License, Version 2.0 (the |
| 7 | + "License"); you may not use this file except in compliance |
| 8 | + with the License. You may obtain a copy of the License at |
| 9 | +
|
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +
|
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + ################################################################################ |
| 18 | +
|
| 19 | +
|
| 20 | +============== |
| 21 | +Compiled Plans |
| 22 | +============== |
| 23 | + |
| 24 | +CompiledPlan |
| 25 | +------------ |
| 26 | + |
| 27 | +Represents an immutable, fully optimized, and executable entity that has been compiled from a |
| 28 | +Table & SQL API pipeline definition. It encodes operators, expressions, functions, data types, |
| 29 | +and table connectors. |
| 30 | + |
| 31 | +Every new Flink version might introduce improved optimizer rules, more efficient operators, |
| 32 | +and other changes that impact the behavior of previously defined pipelines. In order to ensure |
| 33 | +backwards compatibility and enable stateful streaming job upgrades, compiled plans can be |
| 34 | +persisted and reloaded across Flink versions. See the |
| 35 | +`website documentation <https://flink.apache.org/documentation/>`_ for more information about |
| 36 | +provided guarantees during stateful pipeline upgrades. |
| 37 | + |
| 38 | +A plan can be compiled from a SQL query using |
| 39 | +:func:`~pyflink.table.TableEnvironment.compile_plan_sql`. |
| 40 | +It can be persisted using :func:`~pyflink.table.CompiledPlan.write_to_file` or by manually |
| 41 | +extracting the JSON representation with func:`~pyflink.table.CompiledPlan.as_json_string`. |
| 42 | +A plan can be loaded back from a file or a string using |
| 43 | +:func:`~pyflink.table.TableEnvironment.load_plan` with a :class:`~pyflink.table.PlanReference`. |
| 44 | +Instances can be executed using :func:`~pyflink.table.CompiledPlan.execute`. |
| 45 | + |
| 46 | +Depending on the configuration, permanent catalog metadata (such as information about tables |
| 47 | +and functions) will be persisted in the plan as well. Anonymous/inline objects will be |
| 48 | +persisted (including schema and options) if possible or fail the compilation otherwise. |
| 49 | +For temporary objects, only the identifier is part of the plan and the object needs to be |
| 50 | +present in the session context during a restore. |
| 51 | + |
| 52 | +JSON encoding is assumed to be the default representation of a compiled plan in all API |
| 53 | +endpoints, and is the format used to persist the plan to files by default. |
| 54 | +For advanced use cases, :func:`~pyflink.table.CompiledPlan.as_smile_bytes` provides a binary |
| 55 | +format representation of the compiled plan. |
| 56 | + |
| 57 | +.. note:: |
| 58 | + Plan restores assume a stable session context. Configuration, loaded modules and |
| 59 | + catalogs, and temporary objects must not change. Schema evolution and changes of function |
| 60 | + signatures are not supported. |
| 61 | + |
| 62 | +.. currentmodule:: pyflink.table |
| 63 | + |
| 64 | +.. autosummary:: |
| 65 | + :toctree: api/ |
| 66 | + |
| 67 | + CompiledPlan.as_json_string |
| 68 | + CompiledPlan.as_smile_bytes |
| 69 | + CompiledPlan.write_to_file |
| 70 | + CompiledPlan.get_flink_version |
| 71 | + CompiledPlan.print_json_string |
| 72 | + CompiledPlan.execute |
| 73 | + CompiledPlan.explain |
| 74 | + CompiledPlan.print_explain |
| 75 | + |
| 76 | +PlanReference |
| 77 | +------------- |
| 78 | + |
| 79 | +Unresolved pointer to a persisted plan. |
| 80 | + |
| 81 | +A plan represents a static, executable entity that has been compiled from a Table & SQL API |
| 82 | +pipeline definition. |
| 83 | + |
| 84 | +You can load the content of this reference into a :class:`~pyflink.table.CompiledPlan` |
| 85 | +using :func:`~pyflink.table.TableEnvironment.load_plan` with a |
| 86 | +:class:`~pyflink.table.PlanReference`, or you can directly load and execute it with |
| 87 | +:func:`~pyflink.table.TableEnvironment.execute_plan`. |
| 88 | + |
| 89 | +.. seealso:: :class:`~pyflink.table.CompiledPlan` |
| 90 | + |
| 91 | +.. currentmodule:: pyflink.table |
| 92 | + |
| 93 | +.. autosummary:: |
| 94 | + :toctree: api/ |
| 95 | + |
| 96 | + PlanReference.from_file |
| 97 | + PlanReference.from_json_string |
| 98 | + PlanReference.from_smile_bytes |
0 commit comments