Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

[FLINK-41399][table] Let materializeInto convert a regular table - #30232

Open
Timm0 wants to merge 2 commits into
apache:masterfrom
Timm0:FLINK-41399
Open

Timm0 wants to merge 2 commits into
apache:masterfrom
Timm0:FLINK-41399

Conversation

@Timm0

@Timm0 Timm0 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

What is the purpose of the change

Table#materializeInto(...).execute() rejected a regular table at the path, although CREATE OR ALTER MATERIALIZED TABLE converts one when table.materialized-table.conversion-from-table.enabled is set. This pull request removes the
Table API check, so materializeInto goes through the shared MaterializedTableOperationFactory and behaves as SQL: it converts the table when conversion is enabled and rejects it otherwise.

Brief change log

  • Removed the regular-table check in MaterializedPipelineImpl. Under CreateMode.createOrAlter() a regular table is converted, or rejected by the shared factory when conversion is disabled. CreateMode.failIfExists() is unchanged.
  • Documented the conversion in the MaterializedPipeline#execute and CreateMode#createOrAlter() Javadoc, and added a "Converting a Regular Table" section to table-api.md (en + zh) that links the SQL conversion rules.
  • The first commit only groups DefaultMaterializedTableExecutorTest into @Nested classes per operation. The second commit holds the change.

Verifying this change

  • Added DefaultMaterializedTableExecutorTest.Convert#materializeIntoConvertsARegularTable: materializeInto on a regular table converts it into an ACTIVATED continuous materialized table and submits one refresh job.
  • Added DefaultMaterializedTableExecutorTest.Convert#materializeIntoKeepsARegularTableWhenFullRefreshHasNoScheduler: a full-refresh conversion without a workflow scheduler fails before the catalog changes, and the table stays a regular table with no job submitted.
  • Removed MaterializedPipelineImplTest#regularTableAtThePathIsRejected, which tested the removed check. Rejection with conversion disabled stays covered on the shared path by SqlNodeToOperationConvertTableToMaterializedTableTest.
  • The existing MaterializedTableTableApiITCase and the table-module test suites pass.

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): yes
  • 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? yes
  • If yes, how is the feature documented? docs and JavaDocs

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code (Claude Opus 5.5)

…eration

- Move the tests into `@Nested` classes `RefreshStatements`, `Create`, `Convert`, `Alter` and `SuspendAndResume`
- Keep `testData` next to its test in `RefreshStatements` under `@TestInstance(PER_CLASS)`
- Move the statements only `Alter` uses into `Alter`

Generated-by: Claude Code (Claude Opus 5.5)
@Timm0
Timm0 marked this pull request as ready for review December 2, 2026 10:40
@flinkbot

flinkbot commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@AHeise AHeise left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good to me. With the pre-check gone, materializeInto reaches the same handleConvert and executor convert path as CREATE OR ALTER MATERIALIZED TABLE, and the descriptor and SQL merge contexts agree on partition keys, schema/constraint flags, options, distribution and start mode. I found no correctness issue.

The three inline comments are all optional: a test for the conversion-disabled case through the Table API, a docs note for StreamTableEnvironment.create(env, settings), and the error message / Javadoc wording.

- Remove the regular-table check in `MaterializedPipelineImpl`, so `CreateMode.createOrAlter()` converts a regular table when `table.materialized-table.conversion-from-table.enabled` is set, as `CREATE OR ALTER MATERIALIZED TABLE` does
- Name the table, the option and where to set it in the error for a regular table with conversion disabled (shared with SQL)
- Document the conversion in the `MaterializedPipeline#execute`, `CreateMode#createOrAlter()` and `MaterializedTableDescriptor.Builder#partitionedBy` Javadoc and in `table-api.md`
- Cover continuous conversion and the full-refresh rejection without a workflow scheduler in `DefaultMaterializedTableExecutorTest`, and the rejection with conversion disabled in `MaterializedTableTableApiITCase`; drop the obsolete rejection test in `MaterializedPipelineImplTest`

Generated-by: Claude Code (Claude Opus 5.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants