Skip to content

[spark] Support CREATE TABLE LIKE#7663

Merged
JingsongLi merged 1 commit intoapache:masterfrom
Zouxxyy:dev/add-create-table-like
Apr 18, 2026
Merged

[spark] Support CREATE TABLE LIKE#7663
JingsongLi merged 1 commit intoapache:masterfrom
Zouxxyy:dev/add-create-table-like

Conversation

@Zouxxyy
Copy link
Copy Markdown
Contributor

@Zouxxyy Zouxxyy commented Apr 16, 2026

Purpose

Support CREATE TABLE LIKE in Paimon Spark integration on Spark 3.4+.

Behavior:

  • SparkCatalog: rewrite CREATE TABLE LIKE to the Paimon command, except STORED AS, which remains unsupported.
  • If USING is omitted in SparkCatalog, inherit the source table provider.
  • SparkGenericCatalog: rewrite only when USING paimon is specified; otherwise keep Spark native behavior.
  • Copy source table comment and properties only when source and target providers match. If providers differ, keep only the comment and log a warning.

Tests

Updated/covered by:

  • DDLTest
  • DDLWithHiveCatalogTest
  • PaimonFormatTableTest

@LinMingQiang
Copy link
Copy Markdown
Contributor

Is it possible to support creating a new table from a branch?

@Zouxxyy
Copy link
Copy Markdown
Contributor Author

Zouxxyy commented Apr 17, 2026

This is supported now. I added a test to verify CREATE TABLE LIKE works with a branch source like source_tbl$branch_test_branch under SparkCatalog, and the target table is created from the branch metadata rather than the main table metadata.

@Zouxxyy Zouxxyy closed this Apr 17, 2026
@Zouxxyy Zouxxyy reopened this Apr 17, 2026
@Zouxxyy Zouxxyy changed the title [spark] Support CREATE TABLE LIKE [wip] Support CREATE TABLE LIKE Apr 17, 2026
@Zouxxyy Zouxxyy force-pushed the dev/add-create-table-like branch from b8c5be9 to 632403f Compare April 17, 2026 15:56
@Zouxxyy Zouxxyy changed the title [wip] Support CREATE TABLE LIKE [spark] Support CREATE TABLE LIKE Apr 17, 2026
Copy link
Copy Markdown
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

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

+1

@JingsongLi JingsongLi merged commit aa6fff5 into apache:master Apr 18, 2026
13 checks passed
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