AHeise commented on code in PR #30031:
URL: https://github.com/apache/flink/pull/30031#discussion_r4680080132
##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/MaterializedPipeline.java:
##########
@@ -36,46 +37,58 @@ public interface MaterializedPipeline {
ObjectIdentifier getIdentifier();
/**
- * Submits this declaration with the semantics of {@code CREATE OR ALTER
MATERIALIZED TABLE}.
- *
- * <p>If the materialized table exists and its continuous refresh job is
running, the job is
- * stopped with a savepoint and a new refresh job is started, which does
not restore that
- * savepoint. This also happens if the declaration is unchanged. The stop
requires a savepoint
- * directory ({@code execution.checkpointing.savepoint-dir}); without one,
this fails before the
- * stop. If the changes are rejected or cannot be written after the stop,
the materialized table
- * is left suspended with its previous definition and the savepoint. If
the new refresh job
- * starts but the catalog cannot record it, that job is cancelled and the
previous refresh job
- * restarts from the savepoint. If the cancel fails, the materialized
table is rolled back and
- * left suspended instead.
- *
- * <p>A suspended materialized table is altered and stays suspended, and
its stored savepoint is
- * cleared, so a later {@code RESUME} starts the refresh job without
state. A materialized table
- * in full refresh mode is altered without changing its refresh workflow.
- *
- * <p>An existing materialized table keeps its freshness, comment and
partition keys, so a
- * declared one is ignored. Its options and distribution are replaced by
the declared ones, as
- * by the {@code WITH} and {@code DISTRIBUTED BY} clauses of {@code CREATE
OR ALTER MATERIALIZED
- * TABLE}. Options that are not declared are removed, and the distribution
is dropped if none is
- * declared. A declared {@link RefreshStrategy#continuous()} or {@link
RefreshStrategy#full()}
- * that differs from its refresh mode is rejected like any other rejected
change, which leaves a
- * running table suspended. If the declared schema starts with a physical
column, it replaces
- * the watermark, computed columns, virtual metadata columns and primary
key of the materialized
- * table. Otherwise, the materialized table keeps its watermark, keeps
computed and virtual
- * metadata columns that the schema no longer declares, and keeps its
primary key unless the
- * schema declares one.
+ * Submits this declaration with the semantics of {@code CREATE OR ALTER
MATERIALIZED TABLE}. It
Review Comment:
Moving the keep/replace semantics for each field to the `Builder` methods
reads well. But the rewrite also drops the refresh job lifecycle, and no other
Javadoc in `flink-table-api-java` carries it now:
- a running continuous job is stopped with a savepoint and restarted without
state, even for an unchanged declaration
- the stop requires `execution.checkpointing.savepoint-dir`
- the cancel and rollback path if the catalog can't record the new job
- a suspended table stays suspended and loses its savepoint
- a FULL table keeps its refresh workflow
- the method returns once the new job has been submitted, not only once the
table is "created or altered"
`table-api.md` covers part of this, but not the savepoint-dir requirement or
FULL mode. The FLIP's `execute()` Javadoc keeps these paragraphs, and they
aren't related to the start mode. Could we restore them on `execute()`?
The new `@throws` for a `RefreshStrategy` mismatch also loses the old note
that the rejection leaves a running table suspended. The check runs lazily in
`buildTableChanges`, so as far as I can tell it still fires after the stop.
Could we keep that sentence?
##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/materializedtable/MaterializedPipelineImpl.java:
##########
@@ -154,6 +175,29 @@ private Mode toFactoryMode(CreateMode mode) {
return factoryMode;
}
+ private @Nullable StartMode resolveStartMode(@Nullable StartMode
startMode) {
Review Comment:
Optional: `fromNow(Duration)`, `fromTimestamp(Instant)` and their
`resumeOr...` variants already validate, so this check only catches the raw
`StartMode.of(...)` factories. That's fine to keep, but two small things:
- The same rule now has two messages in the Java API: "The start mode offset
must be positive" from `StartMode`, and "interval currently only supports
positive integer type values" here. Reusing the `StartMode` wording would be
more consistent.
- Moving the check into `MaterializedTableOperationFactory#getStartMode`
would put it on the path that SQL and the Table API share. It would still run
before the operation executes, so a rejected redeploy wouldn't stop the job.
--
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]