You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "snuyanzin (via GitHub)" <gi...@apache.org> on 2026/03/30 21:31:41 UTC
[PR] [FLINK-39358][table] Constraint and watermark should stay while CoA MT if there is no explicit change with schema or contraint definition [flink]
snuyanzin opened a new pull request, #27854:
URL: https://github.com/apache/flink/pull/27854
## What is the purpose of the change
Seems to be an issue of `CREATE OR ALTER MATERIALIZED TABLE`, the detailed case is described in jira
## Brief change log
do not look into constraint and watermark changes if there is no schema/constraint definition
## Verifying this change
Tests are added
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): ( no)
- The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
- The serializers: (no )
- The runtime per-record code paths (performance sensitive): (no)
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
- The S3 file system connector: (no)
## Documentation
- Does this pull request introduce a new feature? (no)
- If yes, how is the feature documented? (not applicable)
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39358][table] Constraint and watermark should stay while CoA MT if there is no explicit change with schema or contraint definition [flink]
Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #27854:
URL: https://github.com/apache/flink/pull/27854#issuecomment-4158344896
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "5f0079173f7e9949fcfbc295bf599c286bf669a1",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "5f0079173f7e9949fcfbc295bf599c286bf669a1",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 5f0079173f7e9949fcfbc295bf599c286bf669a1 UNKNOWN
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run azure` re-run the last Azure build
</details>
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39358][table] Constraint and watermark should stay while CoA MT if there is no explicit change with schema or constraint definition [flink]
Posted by "gustavodemorais (via GitHub)" <gi...@apache.org>.
gustavodemorais commented on code in PR #27854:
URL: https://github.com/apache/flink/pull/27854#discussion_r3014564683
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/converters/materializedtable/SqlCreateOrAlterMaterializedTableConverter.java:
##########
@@ -198,23 +198,40 @@ private List<TableChange> getSchemaTableChanges(
final ResolvedCatalogMaterializedTable oldTable) {
final ResolvedSchema oldSchema = oldTable.getResolvedSchema();
final ResolvedSchema newSchema = schemaResolver.resolve(mergeContext.getMergedSchema());
+ final boolean hasSchemaDefinition = mergeContext.hasSchemaDefinition();
final List<TableChange> changes =
new ArrayList<>(
MaterializedTableUtils.validateAndExtractColumnChanges(
- oldSchema, newSchema, mergeContext.hasSchemaDefinition()));
+ oldSchema, newSchema, hasSchemaDefinition));
+ getConstraintChange(oldSchema, newSchema, mergeContext.hasConstraintDefinition())
+ .ifPresent(changes::add);
+ getWatermarkChange(oldSchema, newSchema, hasSchemaDefinition).ifPresent(changes::add);
+ return changes;
+ }
+
+ private Optional<TableChange> getConstraintChange(
+ final ResolvedSchema oldSchema,
+ final ResolvedSchema newSchema,
+ boolean hasConstraintDefinition) {
Review Comment:
```suggestion
final boolean hasConstraintDefinition) {
```
nit: both other function params above and variables below already use final. So suggest to use final to keep the use consistent
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/converters/materializedtable/SqlCreateOrAlterMaterializedTableConverter.java:
##########
@@ -261,6 +277,15 @@ public boolean hasSchemaDefinition() {
&& sqlNodeList.getList().get(0) instanceof SqlRegularColumn;
}
+ @Override
+ public boolean hasConstraintDefinition() {
+ if (!sqlCreateMaterializedTable.getTableConstraints().isEmpty()) {
Review Comment:
I think you could simplify the whole function to
```
return !sqlCreateMaterializedTable.getTableConstraints().isEmpty() || hasSchemaDefinition();
```
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/operations/SqlNodeToOperationSqlCreateOrAlterMaterializedTableConverterTest.java:
##########
@@ -283,7 +282,7 @@ void testCreateOrAlterMaterializedTableWithDistributionForExistingTable()
@Test
void testCreateOrAlterMaterializedTableWithDroppedConstraint() {
Review Comment:
nit
```suggestion
void testCreateOrAlterMaterializedTableWithDroppedConstraintWithExplicitSchema() {
```
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39358][table] Constraint and watermark should stay while CoA MT if there is no explicit change with schema or contraint definition [flink]
Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on PR #27854:
URL: https://github.com/apache/flink/pull/27854#issuecomment-4160701250
@flinkbot run azure
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39358][table] Constraint and watermark should stay while CoA MT if there is no explicit change with schema or constraint definition [flink]
Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin merged PR #27854:
URL: https://github.com/apache/flink/pull/27854
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org