Tartarus0zm commented on code in PR #20392:
URL: https://github.com/apache/flink/pull/20392#discussion_r937356970
##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/stream/sql/TableSinkITCase.scala:
##########
@@ -192,4 +193,41 @@ class TableSinkITCase(mode: StateBackendMode) extends
StreamingWithStateTestBase
)
assertEquals(expected.sorted, result.sorted)
}
+
+ @Test
+ def testCreateTableAsSelect(): Unit = {
+ tEnv
+ .executeSql("""
+ |CREATE TABLE MyCtasTable
+ | WITH (
+ | 'connector' = 'values',
+ | 'sink-insert-only' = 'true'
+ |) AS
+ | SELECT
+ | `person`,
+ | `votes`
+ | FROM
+ | src
+ |""".stripMargin)
+ .await()
+ val actual = TestValuesTableFactory.getResults("MyCtasTable")
+ val expected = List(
+ "+I[jason, 1]",
+ "+I[jason, 1]",
+ "+I[jason, 1]",
+ "+I[jason, 1]"
+ )
+ Assertions.assertThat(actual.sorted).isEqualTo(expected.sorted)
+ }
+
+ @Test
+ def testCreateTableAsSelectWithoutOptions(): Unit = {
+ // TODO CTAS supports ManagedTable
+ Assertions
Review Comment:
If the connector option is not specified, Flink will creates a Managed table.
Managed table relies on checkpoint to commit and the data is visible only
after commit.
Managed table requires two layers of log storage and file storage and
depends on the flink table store, CTAS will support Managed Table in the future.
--
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]