raminqaf commented on code in PR #28287: URL: https://github.com/apache/flink/pull/28287#discussion_r3357442404
########## docs/content/docs/sql/materialized-table/statements.md: ########## @@ -260,6 +261,56 @@ The operation updates the materialized table similarly to [ALTER MATERIALIZED TA See [ALTER MATERIALIZED TABLE AS](#as-select_statement-1) for more details. +## Converting a Table to a Materialized Table + +`CREATE OR ALTER MATERIALIZED TABLE` can convert an existing regular table into a materialized table in place. The catalog object keeps its identity and underlying storage; only the table kind and the materialized-table metadata (query definition, freshness, refresh mode, and refresh status) change. After the conversion, a refresh job is launched just as it is for a newly created materialized table. + +This lets you adopt a materialized table on top of a table that already exists, without dropping and recreating it. + +**Enabling conversion** + +Conversion is disabled by default. To enable it, set the following option in the cluster configuration file `config.yaml`: + +```yaml +table.materialized-table.conversion-from-table.enabled: true +``` + +This is a cluster-wide setting: it must be set in the cluster configuration, and a session-level `SET` statement has no effect. When the option is disabled, `CREATE OR ALTER MATERIALIZED TABLE` against a regular table is rejected. + +**Watermark and primary key inheritance** + +When the conversion statement does not declare a `WATERMARK` or a `PRIMARY KEY`, the corresponding definition is inherited from the source table: Review Comment: That is correct. Corrected the docs here and the logic -- 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]
