raminqaf opened a new pull request, #28287:
URL: https://github.com/apache/flink/pull/28287

   ## What is the purpose of the change
   This is the implementation of the [FLIP-578: In-place Table to Materialized 
Table 
conversion](https://cwiki.apache.org/confluence/display/FLINK/FLIP-578%3A+In-place+Table+to+Materialized+Table+conversion)
   
   Introduce the building blocks for in-place conversion of a regular table to 
a materialized table use the already existing CoA command.
   
   ## Brief change log
   
   *(for example:)*
     - Add the cluster-level 
`table.materialized-table.conversion-from-table.enabled` option (default 
`false`) that gates the conversion. It is read from the root configuration, so 
a session-level SET has no effect.
   
   - Add `Catalog#convertTableToMaterializedTable`, which swaps an existing 
regular table's catalog entry for a materialized table in place while 
preserving its identity and storage. The default throws 
`UnsupportedOperationException`; `GenericInMemoryCatalog` overrides it with a 
table-kind check. `CatalogManager` resolves both tables, delegates to the 
catalog, and fires an `AlterTableEvent`. Launching the refresh job is left to 
the executor, not the catalog.
   
   - handleCreateOrAlter now dispatches on the kind of the existing object: a 
materialized table is altered as before, a view is rejected, and a regular 
table is converted in place to a materialized table when 
`table.materialized-table.conversion-from-table.enabled` is set on the cluster 
(otherwise the statement is rejected as before). The conversion carries over 
the source table's watermark and primary key when the DDL omits them, rejecting 
a source with more than one watermark. It emits the structured TableChanges 
(columns, constraint, watermark, definition query, options, distribution, start 
mode) by reusing the shared change-building helpers, and returns a 
`ConvertTableToMaterializedTableOperation`.
   
   
   ## Verifying this change
   
    - Added test in `SqlNodeToOperationConvertTableToMaterializedTableTest`
    - Added ITs in `MaterializedTableStatementITCase`
   
   ## 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/JavaDocs
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, 
please
   change the checkbox below to `[X]` followed by the name of the tool, and 
uncomment the
   "Generated-by" line. See the ASF Generative Tooling Guidance for details:
   https://www.apache.org/legal/generative-tooling.html
   
   You are responsible for the quality and correctness of every change in this 
PR
   regardless of the tooling used. Low-effort AI-generated PRs will be closed. 
See
   AGENTS.md for the full guidance.
   -->
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Opus 4.8
   
   


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