Skip to content

[FLINK-38968][table] Add toCatalogTable method to CatalogMaterializedTable interface#27467

Merged
snuyanzin merged 1 commit intoapache:masterfrom
raminqaf:FLINK-38968
Mar 27, 2026
Merged

[FLINK-38968][table] Add toCatalogTable method to CatalogMaterializedTable interface#27467
snuyanzin merged 1 commit intoapache:masterfrom
raminqaf:FLINK-38968

Conversation

@raminqaf
Copy link
Copy Markdown
Contributor

What is the purpose of the change

This pull request adds a default toCatalogTable() method to the CatalogMaterializedTable interface, which converts a materialized table to a CatalogTable for planner query optimization. This extracts the conversion logic to the interface level, allowing ResolvedCatalogMaterializedTable.toResolvedCatalogTable() to delegate to origin.toCatalogTable() instead of duplicating the conversion logic.

Brief change log

  • Added default method toCatalogTable() in CatalogMaterializedTable interface that builds a CatalogTable from the materialized table's schema, comment, distribution, partition keys, options, and snapshot
  • Updated ResolvedCatalogMaterializedTable.toResolvedCatalogTable() to use the new origin.toCatalogTable() method

Verifying this change

This change added tests and can be verified as follows:

  • Added testCatalogMaterializedTableToCatalogTable() in CatalogBaseTableResolutionTest to verify the new toCatalogTable() method preserves all properties (schema, comment, partition keys, options, distribution, snapshot)
  • Added testResolvedCatalogMaterializedTableToResolvedCatalogTable() in CatalogBaseTableResolutionTest to verify the conversion from ResolvedCatalogMaterializedTable to ResolvedCatalogTable preserves schema and origin properties

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 (CatalogMaterializedTable is @PublicEvolving)
  • 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

@flinkbot
Copy link
Copy Markdown
Collaborator

flinkbot commented Jan 23, 2026

CI report:

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

@raminqaf
Copy link
Copy Markdown
Contributor Author

@flinkbot run azure

@Nullable
byte[] getSerializedRefreshHandler();

/** Convert this object to a {@link CatalogTable} object for planner optimize query. */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/**

  • Converts this materialized table into a {@link CatalogTable} representation
  • for planner usage.
  • This conversion preserves schema, options, distribution, partitions and snapshot,

  • but intentionally drops materialized-table-specific semantics such as refresh behavior.
    */

}

@Test
void testCatalogMaterializedTableToCatalogTable() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Consider adding a test asserting that materialized-table-specific semantics (e.g. refresh behavior) are intentionally not propagated.

@github-actions github-actions Bot added the community-reviewed PR has been reviewed by the community. label Jan 27, 2026
Copy link
Copy Markdown
Contributor

@snuyanzin snuyanzin left a comment

Choose a reason for hiding this comment

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

Looks like a missing feature while implementation of MT

@snuyanzin snuyanzin merged commit 004268a into apache:master Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-reviewed PR has been reviewed by the community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants