slinkydeveloper commented on a change in pull request #18724:
URL: https://github.com/apache/flink/pull/18724#discussion_r804512886
##########
File path:
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/api/TableEnvironmentITCase.scala
##########
@@ -158,52 +156,75 @@ class TableEnvironmentITCase(tableEnvName: String,
isStreaming: Boolean) extends
tEnv, new TableSchema(Array("first"), Array(STRING)), "MySink1")
val table1 = tEnv.sqlQuery("select first from MyTable")
- tEnv.insertInto(table1, "MySink1")
-
- tEnv.explain(false)
- tEnv.execute("test1")
+ table1.executeInsert("MySink1").await()
assertFirstValues(sinkPath)
}
@Test
- def testExplainAndExecuteMultipleSink(): Unit = {
- val sink1Path = TestTableSourceSinks.createCsvTemporarySinkTable(
+ def testExecuteSqlWithInsertInto(): Unit = {
+ val sinkPath = TestTableSourceSinks.createCsvTemporarySinkTable(
tEnv, new TableSchema(Array("first"), Array(STRING)), "MySink1")
+ checkEmptyFile(sinkPath)
+ val tableResult = tEnv.executeSql("insert into MySink1 select first from
MyTable")
+ checkInsertTableResult(tableResult,
"default_catalog.default_database.MySink1")
+ assertFirstValues(sinkPath)
+ }
- val sink2Path = TestTableSourceSinks.createCsvTemporarySinkTable(
- tEnv, new TableSchema(Array("first"), Array(STRING)), "MySink2")
+ @Test
+ def testExecuteSqlWithInsertOverwrite(): Unit = {
+ if(isStreaming) {
+ // Streaming mode not support overwrite for FileSystemTableSink.
+ return
+ }
- val table1 = tEnv.sqlQuery("select first from MyTable")
- tEnv.insertInto(table1, "MySink1")
- val table2 = tEnv.sqlQuery("select last from MyTable")
- tEnv.insertInto(table2, "MySink2")
+ val sinkPath = _tempFolder.newFolder().toString
+ tEnv.executeSql(
+ s"""
+ |create table MySink (
+ | first string
+ |) with (
+ | 'connector' = 'filesystem',
+ | 'path' = '$sinkPath',
+ | 'format' = 'testcsv'
+ |)
+ """.stripMargin
+ )
- tEnv.explain(false)
- tEnv.execute("test1")
- assertFirstValues(sink1Path)
- assertLastValues(sink2Path)
+ val tableResult1 = tEnv.executeSql("insert overwrite MySink select first
from MyTable")
+ checkInsertTableResult(tableResult1,
"default_catalog.default_database.MySink")
+ assertFirstValues(sinkPath)
+
+ val tableResult2 = tEnv.executeSql("insert overwrite MySink select first
from MyTable")
+ checkInsertTableResult(tableResult2,
"default_catalog.default_database.MySink")
+ assertFirstValues(sinkPath)
}
@Test
- def testExplainTwice(): Unit = {
Review comment:
This method and the one above has been remove as they were essentially
testing the buffering behaviour
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]