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/12/04 06:51:02 UTC

[GitHub] [flink] godfreyhe commented on a change in pull request #14165: [FLINK-19687][table] Support to get execution plan from StatementSet

godfreyhe commented on a change in pull request #14165:
URL: https://github.com/apache/flink/pull/14165#discussion_r535874435



##########
File path: flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/api/TableEnvironmentTest.scala
##########
@@ -103,6 +103,26 @@ class TableEnvironmentTest {
     assertEquals(TableTestUtil.replaceStageId(expected), TableTestUtil.replaceStageId(actual))
   }
 
+  @Test
+  def testStreamTableEnvironmentExecutionExplain(): Unit = {

Review comment:
       please also add some test cases for legacy planner

##########
File path: flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/api/TableEnvironmentITCase.scala
##########
@@ -429,6 +429,26 @@ class TableEnvironmentITCase(tableEnvName: String, isStreaming: Boolean) extends
     assertLastValues(sink2Path)
   }
 
+  @Test
+  def testExecutionPlanFromStatementSet(): Unit = {
+    val sink1Path = TestTableSourceSinks.createCsvTemporarySinkTable(
+      tEnv, new TableSchema(Array("first"), Array(STRING)), "MySink1")
+
+    val sink2Path = TestTableSourceSinks.createCsvTemporarySinkTable(
+      tEnv, new TableSchema(Array("last"), Array(STRING)), "MySink2")
+
+    val stmtSet = tEnv.createStatementSet()
+    stmtSet.addInsert("MySink1", tEnv.sqlQuery("select first from MyTable"))
+        .addInsertSql("insert into MySink2 select last from MyTable")
+
+    val actual = stmtSet.explain(ExplainDetail.JSON_EXECUTION_PLAN)
+    val expected =
+      TableTestUtil.readFromResource("/explain/testExecutionPlanFromStatementSet.out")
+
+    assertEquals(replaceStreamNodeIdAndParallelism(expected),
+      replaceStreamNodeIdAndParallelism(actual))

Review comment:
       This test case is a unit test, not an integration test, so this test case should be removed to `TableEnvironmentTest`
   
   nit: `sink1Path` and `sink2Path` are unnecessary




----------------------------------------------------------------
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