You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ku...@apache.org on 2019/03/20 02:25:21 UTC
[flink] branch master updated: [FLINK-11946][table-planner-blink]
Introduce ExecNode to blink planner (#8010)
This is an automated email from the ASF dual-hosted git repository.
kurt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new 475a88c [FLINK-11946][table-planner-blink] Introduce ExecNode to blink planner (#8010)
475a88c is described below
commit 475a88c26a0c487bbf07cd51c16599911ab4a740
Author: Jing Zhang <be...@126.com>
AuthorDate: Wed Mar 20 10:25:12 2019 +0800
[FLINK-11946][table-planner-blink] Introduce ExecNode to blink planner (#8010)
---
.../table/plan/nodes/exec/ExecNodeVisitor.java | 33 +++++++++
.../table/plan/nodes/exec/BatchExecNode.scala | 34 ++++++++++
.../flink/table/plan/nodes/exec/ExecNode.scala | 78 ++++++++++++++++++++++
.../table/plan/nodes/exec/StreamExecNode.scala | 26 ++++++++
4 files changed, 171 insertions(+)
diff --git a/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/nodes/exec/ExecNodeVisitor.java b/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/nodes/exec/ExecNodeVisitor.java
new file mode 100644
index 0000000..99ce273
--- /dev/null
+++ b/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/nodes/exec/ExecNodeVisitor.java
@@ -0,0 +1,33 @@
+/*
+ * 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.plan.nodes.exec;
+
+/**
+ * Visitor pattern for traversing a dag of {@link ExecNode} objects.
+ */
+public interface ExecNodeVisitor {
+
+ /**
+ * Visits a node during a traversal.
+ *
+ * @param node ExecNode to visit
+ */
+ void visit(ExecNode<?, ?> node);
+
+}
diff --git a/flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/nodes/exec/BatchExecNode.scala b/flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/nodes/exec/BatchExecNode.scala
new file mode 100644
index 0000000..5264732
--- /dev/null
+++ b/flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/nodes/exec/BatchExecNode.scala
@@ -0,0 +1,34 @@
+/*
+ * 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.plan.nodes.exec
+
+import org.apache.flink.runtime.operators.DamBehavior
+import org.apache.flink.table.api.BatchTableEnvironment
+
+/**
+ * Base class for batch ExecNode.
+ */
+trait BatchExecNode[T] extends ExecNode[BatchTableEnvironment, T] {
+
+ /**
+ * Returns [[DamBehavior]] of this node.
+ */
+ def getDamBehavior: DamBehavior
+
+}
diff --git a/flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/nodes/exec/ExecNode.scala b/flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/nodes/exec/ExecNode.scala
new file mode 100644
index 0000000..869db32
--- /dev/null
+++ b/flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/nodes/exec/ExecNode.scala
@@ -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.
+ */
+
+package org.apache.flink.table.plan.nodes.exec
+
+import org.apache.flink.streaming.api.transformations.StreamTransformation
+import org.apache.flink.table.api.TableEnvironment
+import org.apache.flink.table.plan.nodes.physical.FlinkPhysicalRel
+
+import java.util
+
+/**
+ * The representation of execution information for a [[FlinkPhysicalRel]].
+ *
+ * @tparam E The TableEnvironment
+ * @tparam T The type of the elements that result from this [[StreamTransformation]]
+ */
+trait ExecNode[E <: TableEnvironment, T] {
+
+ /**
+ * The [[StreamTransformation]] translated from this node.
+ */
+ private var transformation: StreamTransformation[T] = _
+
+ /**
+ * Translates this node into a Flink operator.
+ *
+ * <p>NOTE: returns same translate result if called multiple times.
+ *
+ * @param tableEnv The [[TableEnvironment]] of the translated Table.
+ */
+ def translateToPlan(tableEnv: E): StreamTransformation[T] = {
+ if (transformation == null) {
+ transformation = translateToPlanInternal(tableEnv)
+ }
+ transformation
+ }
+
+ /**
+ * Internal method, translates this node into a Flink operator.
+ *
+ * @param tableEnv The [[TableEnvironment]] of the translated Table.
+ */
+ protected def translateToPlanInternal(tableEnv: E): StreamTransformation[T]
+
+ /**
+ * Returns an array of this node's inputs. If there are no inputs,
+ * returns an empty list, not null.
+ *
+ * @return Array of this node's inputs
+ */
+ def getInputNodes: util.List[ExecNode[E, _]]
+
+ /**
+ * Accepts a visit from a [[ExecNodeVisitor]].
+ *
+ * @param visitor ExecNodeVisitor
+ */
+ def accept(visitor: ExecNodeVisitor): Unit = {
+ visitor.visit(this)
+ }
+
+}
diff --git a/flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/nodes/exec/StreamExecNode.scala b/flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/nodes/exec/StreamExecNode.scala
new file mode 100644
index 0000000..2f5e705
--- /dev/null
+++ b/flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/nodes/exec/StreamExecNode.scala
@@ -0,0 +1,26 @@
+/*
+ * 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.plan.nodes.exec
+
+import org.apache.flink.table.api.StreamTableEnvironment
+
+/**
+ * Base class for stream ExecNode.
+ */
+trait StreamExecNode[T] extends ExecNode[StreamTableEnvironment, T]