autophagy commented on code in PR #26167: URL: https://github.com/apache/flink/pull/26167#discussion_r1971312093
########## flink-python/pyflink/table/table_pipeline.py: ########## @@ -0,0 +1,78 @@ +################################################################################ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################ + +from typing import Optional +from pyflink.java_gateway import get_gateway +from pyflink.table import ExplainDetail +from pyflink.table.catalog import ObjectIdentifier +from pyflink.table.table_result import TableResult +from pyflink.util.java_utils import to_j_explain_detail_arr + +__all__ = ["TablePipeline"] + + +class TablePipeline(object): + """ + Describes a complete pipeline from one or more source tables to a sink table. + """ + + def __init__(self, j_table_pipeline, t_env): + self._j_table_pipeline = j_table_pipeline + self._t_env = t_env + + def __str__(self) -> str: + return self._j_table_pipeline.toString() + + def execute(self) -> TableResult: + """ + Executes the table pipeline. + + .. versionadded:: 2.1.0 + """ + self._t_env._before_execute() + return TableResult(self._j_table_pipeline.execute()) + + def explain(self, *extra_details: ExplainDetail) -> str: + """ + Returns the AST and the execution plan of the table pipeline. + + :param extra_details: The extra explain details which the explain result should include, Review Comment: They are just `ExplainDetails`, as suggested by the type annotation, similar to the existing `Table.explain`. For example: ``` pipeline.explain( ExplainDetail.ESTIMATED_COST, ExplainDetail.CHANGELOG_MODE, ExplainDetail.JSON_EXECUTION_PLAN, ExplainDetail.PLAN_ADVICE ) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org