Timm0 commented on code in PR #30239:
URL: https://github.com/apache/flink/pull/30239#discussion_r4784467806


##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/MaterializedTableEvolution.java:
##########
@@ -94,6 +150,17 @@ public interface MaterializedTableEvolution extends 
Explainable<MaterializedTabl
      *
      * @return A new handle on the altered table.
      * @throws ValidationException if the table does not exist or is not a 
materialized table
+     * @throws ValidationException if a schema change names a column, 
watermark, primary key or
+     *     constraint that the schema left by the earlier changes does not 
define, or adds one that
+     *     it already defines
+     * @throws ValidationException if a schema change changes the kind of a 
column
+     * @throws ValidationException if a dropped column is produced by the 
query, unless it is a

Review Comment:
   The rule stays in the executor. `dropColumns` now says the drop may be 
rejected when the alter is executed.



##########
docs/content/docs/sql/materialized-table/table-api.md:
##########
@@ -158,6 +158,31 @@ as one `CREATE OR ALTER MATERIALIZED TABLE`, with the 
effects described in
 distribution and the start mode. An alter that changes nothing leaves the 
materialized table and
 its refresh job untouched. In `explain()`, options that the alter resets still 
apply to the sink.
 
+`addSchema`, `modifySchema`, `dropColumns`, `dropWatermark`, `dropPrimaryKey` 
and `dropConstraint`
+change the schema like
+[`ALTER MATERIALIZED TABLE ... ADD`]({{< ref 
"docs/sql/materialized-table/statements" >}}#add),
+[`MODIFY`]({{< ref "docs/sql/materialized-table/statements" >}}#modify) and
+[`DROP`]({{< ref "docs/sql/materialized-table/statements" >}}#drop):
+
+```java
+tEnv.fromMaterializedTable("orders_curated")
+        .alter()
+        .addSchema(Schema.newBuilder()
+                .columnByExpression("order_hour", "HOUR(`order_time`)")
+                .build())
+        .modifySchema(Schema.newBuilder()
+                .watermark("order_time", 
$("order_time").minus(lit(10).seconds()))
+                .build())
+        .execute();
+```
+
+Unlike the SQL clauses, they also accept physical and persisted metadata 
columns, and they combine

Review Comment:
   Done.



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