raminqaf commented on code in PR #28510:
URL: https://github.com/apache/flink/pull/28510#discussion_r3457803909


##########
flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/service/MaterializedTableConversionITCase.java:
##########
@@ -293,6 +295,39 @@ 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";
+
+        verifyExplainPlan(
+                service,
+                sessionHandle,
+                fileSystemCatalogName,
+                explainDDL,
+                "/explain/testExplainConvertTableToMaterializedTable.out");
+
+        // EXPLAIN is side-effect-free: the entry is still a regular table, 
not converted.
+        assertThat(
+                        service.getTable(sessionHandle, 
getObjectIdentifier("users_shops"))
+                                .getTableKind())
+                .isSameAs(CatalogBaseTable.TableKind.TABLE);

Review Comment:
   Added static import



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

Reply via email to