snuyanzin commented on code in PR #28510:
URL: https://github.com/apache/flink/pull/28510#discussion_r3498154030
##########
flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/service/MaterializedTableConversionITCase.java:
##########
@@ -293,6 +294,40 @@ void
testConvertTableLeftSuspendedWhenRefreshJobFailsToStart() throws Exception
assertThat(suspendedMaterializedTable.getRefreshStatus()).isSameAs(RefreshStatus.SUSPENDED);
}
+ @Test
+ void testExplainConvertTableToMaterializedTable() throws Exception {
+ // pre-create a regular table that CREATE OR ALTER would convert in
place.
+ String createRegularTableDDL =
+ "CREATE TABLE users_shops (\n"
+ + " user_id BIGINT,\n"
+ + " shop_id BIGINT,\n"
+ + " payment_amount_cents BIGINT\n"
+ + ")\n"
+ + "WITH ('connector' = 'values')";
+ OperationHandle createTableHandle =
+ executeStatement(service, sessionHandle,
createRegularTableDDL);
+ awaitOperationTermination(service, sessionHandle, createTableHandle);
+
+ String explainDDL =
+ "EXPLAIN CREATE OR ALTER MATERIALIZED TABLE users_shops"
+ + " FRESHNESS = INTERVAL '30' SECOND"
+ + " AS SELECT user_id, shop_id, payment_amount_cents
FROM datagenSource";
+
+ // EXPLAIN succeeds and returns a single non-empty plan. The plan
content itself is asserted
+ // by the planner tests in TableSinkTest.
+ OperationHandle explainHandle = executeStatement(service,
sessionHandle, explainDDL);
+ awaitOperationTermination(service, sessionHandle, explainHandle);
+ List<RowData> explainResults = fetchAllResults(service, sessionHandle,
explainHandle);
+ assertThat(explainResults).hasSize(1);
+ assertThat(explainResults.get(0).getString(0).toString()).isNotBlank();
Review Comment:
didn't get it: why are we satisfied with just non blank result here?
--
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]