You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/04/21 07:29:03 UTC

[GitHub] [flink] wuchong commented on a change in pull request #11794: [FLINK-17126] [table-planner] Correct the execution behavior of BatchTableEnvironment

wuchong commented on a change in pull request #11794:
URL: https://github.com/apache/flink/pull/11794#discussion_r411906063



##########
File path: flink-java/src/main/java/org/apache/flink/api/java/utils/CollectionPipelineExecutor.java
##########
@@ -0,0 +1,92 @@
+/*
+ * 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.api.java.utils;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.JobExecutionResult;
+import org.apache.flink.api.common.JobID;
+import org.apache.flink.api.common.JobStatus;
+import org.apache.flink.api.common.Plan;
+import org.apache.flink.api.common.operators.CollectionExecutor;
+import org.apache.flink.api.dag.Pipeline;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.core.execution.JobClient;
+import org.apache.flink.core.execution.PipelineExecutor;
+
+import javax.annotation.Nullable;
+
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * An {@link PipelineExecutor} for serial, local, collection-based executions of Flink programs.
+ */
+@Internal
+public class CollectionPipelineExecutor implements PipelineExecutor {
+
+	public static final String NAME = "collection";
+
+	@Override
+	public CompletableFuture<? extends JobClient> execute(
+			Pipeline pipeline,
+			Configuration configuration) throws Exception {
+		Plan plan = (Plan) pipeline;
+		CollectionExecutor exec = new CollectionExecutor(plan.getExecutionConfig());
+		JobExecutionResult result = exec.execute(plan);
+
+		return CompletableFuture.completedFuture(new JobClient() {
+			@Override
+			public JobID getJobID() {
+				return new JobID();
+			}
+
+			@Override
+			public CompletableFuture<JobStatus> getJobStatus() {
+				return CompletableFuture.completedFuture(JobStatus.FINISHED);
+			}
+
+			@Override
+			public CompletableFuture<Void> cancel() {
+				return null;

Review comment:
       return CompletableFuture.completedFuture(null);?
   
   Same for the following. 

##########
File path: flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/util/DummyNoOpOperator.java
##########
@@ -0,0 +1,55 @@
+/*
+ * 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.util;
+
+import org.apache.flink.api.common.io.FileInputFormat;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.api.java.DataSet;
+import org.apache.flink.api.java.ExecutionEnvironment;
+import org.apache.flink.api.java.operators.NoOpOperator;
+
+import java.io.IOException;
+
+/**
+ * This is dummy {@link NoOpOperator}, which context is {@link DummyExecutionEnvironment}.
+ */
+public class DummyNoOpOperator<IN> extends NoOpOperator<IN> {
+
+	public DummyNoOpOperator(
+		ExecutionEnvironment dummyExecEnv,

Review comment:
       Indent. 

##########
File path: flink-java/src/main/java/org/apache/flink/api/java/utils/CollectionPipelineExecutor.java
##########
@@ -0,0 +1,92 @@
+/*
+ * 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.api.java.utils;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.JobExecutionResult;
+import org.apache.flink.api.common.JobID;
+import org.apache.flink.api.common.JobStatus;
+import org.apache.flink.api.common.Plan;
+import org.apache.flink.api.common.operators.CollectionExecutor;
+import org.apache.flink.api.dag.Pipeline;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.core.execution.JobClient;
+import org.apache.flink.core.execution.PipelineExecutor;
+
+import javax.annotation.Nullable;
+
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * An {@link PipelineExecutor} for serial, local, collection-based executions of Flink programs.
+ */
+@Internal
+public class CollectionPipelineExecutor implements PipelineExecutor {
+
+	public static final String NAME = "collection";
+
+	@Override
+	public CompletableFuture<? extends JobClient> execute(
+			Pipeline pipeline,
+			Configuration configuration) throws Exception {
+		Plan plan = (Plan) pipeline;
+		CollectionExecutor exec = new CollectionExecutor(plan.getExecutionConfig());
+		JobExecutionResult result = exec.execute(plan);
+
+		return CompletableFuture.completedFuture(new JobClient() {

Review comment:
       I think maybe we can take `TestingJobClient` as an example to avoid returning null result.




----------------------------------------------------------------
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:
users@infra.apache.org