dawidwys commented on a change in pull request #9433: [FLINK-13708] [table-planner-blink] transformations should be cleared after execution in blink planner URL: https://github.com/apache/flink/pull/9433#discussion_r347837319
########## File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/utils/DummyStreamExecutionEnvironment.java ########## @@ -0,0 +1,289 @@ +/* + * 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. + */ + +package org.apache.flink.table.planner.utils; + +import org.apache.flink.api.common.ExecutionConfig; +import org.apache.flink.api.common.JobExecutionResult; +import org.apache.flink.api.common.cache.DistributedCache; +import org.apache.flink.api.common.restartstrategy.RestartStrategies; +import org.apache.flink.api.dag.Transformation; +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.runtime.state.AbstractStateBackend; +import org.apache.flink.runtime.state.StateBackend; +import org.apache.flink.streaming.api.CheckpointingMode; +import org.apache.flink.streaming.api.TimeCharacteristic; +import org.apache.flink.streaming.api.environment.CheckpointConfig; +import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; +import org.apache.flink.streaming.api.graph.StreamGraph; +import org.apache.flink.table.planner.delegation.PlannerBase; + +import com.esotericsoftware.kryo.Serializer; + +import java.io.Serializable; +import java.util.List; + +/** + * This is dummy {@link StreamExecutionEnvironment}, only used for {@link PlannerBase#explain(List, boolean)} method. + * + * <P>{@link Transformation}s will be added into a {@link StreamExecutionEnvironment} when translating ExecNode to plan, + * and they will be cleared only when calling {@link StreamExecutionEnvironment#execute()} method. + * + * <p>{@link PlannerBase#explain(List, boolean)} method will not only print logical plan but also execution plan, + * translating will happen in explain method. If calling explain method before execute method, the transformations in + * StreamExecutionEnvironment is dirty, and execution result may be incorrect. + * + * <p> All set methods (e.g. setXXX, enableXXX, disableXXX, etc) are disabled to prohibit changing configuration, + * all get methods (e.g. getXXX, isXXX) will be delegated to real StreamExecutionEnvironment. + * `execute`, `getStreamGraph`, `getExecutionPlan` methods are also disabled. + */ +public class DummyStreamExecutionEnvironment extends StreamExecutionEnvironment { Review comment: So actually I was right at the very beginning :man_facepalming: I'm fine with how it is for now. Lets maybe make sure it is well documented what are the assumptions on that class and why was it introduced. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
