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


##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/ShowCreateUtil.java:
##########


Review Comment:
   ```suggestion
       static String buildCreateOrAlterFormattedPrefix(
   ```



##########
flink-table/flink-table-api-java/src/test/java/org/apache/flink/table/api/internal/ShowCreateUtilTest.java:
##########
@@ -124,8 +124,19 @@ void showCreateMaterializedTable(
                         materializedTable,
                         MATERIALIZED_TABLE_IDENTIFIER,
                         false,
+                        false,
                         DefaultSqlFactory.INSTANCE);
         assertThat(createMaterializedTableString).isEqualTo(expected);
+
+        final String createOrAlterMaterializedTableString =
+                ShowCreateUtil.buildShowCreateMaterializedTableRow(
+                        materializedTable,
+                        MATERIALIZED_TABLE_IDENTIFIER,
+                        false,
+                        true,
+                        DefaultSqlFactory.INSTANCE);
+        assertThat(createOrAlterMaterializedTableString)
+                .isEqualTo(expected.replaceFirst("CREATE ", "CREATE OR ALTER 
"));
     }

Review Comment:
   Test can be simplified WDYT?
   ```java
       @ParameterizedTest(name = "{index}: {2}")
       @MethodSource("argsForShowCreateMaterializedTable")
       void showCreateMaterializedTable(
               ResolvedCatalogMaterializedTable materializedTable,
               boolean isCreateOrAlter,
               String expected) {
           final String createMaterializedTableString =
                   ShowCreateUtil.buildShowCreateMaterializedTableRow(
                           materializedTable,
                           MATERIALIZED_TABLE_IDENTIFIER,
                           false,
                           isCreateOrAlter,
                           DefaultSqlFactory.INSTANCE);
           assertThat(createMaterializedTableString).isEqualTo(expected);
       }
   
   private static Collection<Arguments> argsForShowCreateMaterializedTable() {
   //...
   }
   
      private static void addCreateAndCreateOrAlter(
               Collection<Arguments> argList,
               ResolvedCatalogMaterializedTable materializedTable,
               String sql) {
           argList.add(Arguments.of(materializedTable, false, 
String.format(sql, "")));
           argList.add(Arguments.of(materializedTable, true, String.format(sql, 
"OR ALTER ")));
       }
   ```



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