Skip to content

[spark] Add Format Table partition operation tests and clearer errors - #9119

Merged
JingsongLi merged 5 commits into
apache:masterfrom
sundapeng:upstream/s7-format-table-partition-operations
Aug 12, 2026
Merged

[spark] Add Format Table partition operation tests and clearer errors#9119
JingsongLi merged 5 commits into
apache:masterfrom
sundapeng:upstream/s7-format-table-partition-operations

Conversation

@sundapeng

@sundapengsundapeng commented Aug 9, 2026

Copy link
Copy Markdown
Member

Purpose

Add Spark SQL end-to-end tests for partition operations on a catalog-managed Format Table: ADD / DROP PARTITION, SHOW PARTITIONS, writer-side registration, MSCK discovery, partial specs, and null / empty / default partition values. TRUNCATE PARTITION and RENAME PARTITION stay unsupported, and the tests pin that a rejected command leaves catalog registrations and rows unchanged.

This PR also clarifies two refusal messages:

  • Only FileStoreTable supports partitions was wrong for a partitioned Format Table. The message now says the operation is supported only for a native Paimon table and points Format Table users to ADD PARTITION, DROP PARTITION, and MSCK REPAIR TABLE.
  • ADD PARTITION and DROP PARTITION on a Format Table with filesystem-discovered partitions now explain that a partition is a plain directory under the table location, to be created or removed directly, and how to enable catalog-managed partitions with metastore.partitioned-table and MSCK REPAIR TABLE.

No public API, REST contract, or storage format change.

Tests

  • New DDL and edge parity suites: 16/16 passed.
  • FormatTablePartitionDdlPlanningTest: 22/22 passed, covering the filesystem-discovery refusal messages.

@JingsongLi

Copy link
Copy Markdown
Contributor

CI failed

@sundapeng

sundapeng commented Aug 11, 2026

Copy link
Copy Markdown
MemberAuthor

Local Spark 3.5 / Scala 2.12 evidence:

  • before: 9 of 10 Scala tests passed; only the ANALYZE case failed with NOT_SUPPORTED_COMMAND_FOR_V2_TABLE
  • after: 9 of 9 Scala tests and 66 of 66 Java tests passed

Fix: 22e5269.

@sundapengsundapeng changed the title [spark] Cover the partition operations left over on format tables[spark][test] Add tests for catalog-managed Format Table partitionsAug 11, 2026
@sundapengsundapeng changed the title [spark][test] Add tests for catalog-managed Format Table partitions[spark] Add tests for catalog-managed Format Table partitionsAug 11, 2026

@leaves12138leaves12138 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 for adding this coverage. I found two issues that should be addressed before merging.

@leaves12138leaves12138 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.

LGTM. Thanks for addressing the comments.

TRUNCATE TABLE, TRUNCATE TABLE PARTITION and ALTER TABLE ... RENAME TO PARTITION
all refuse a format table with catalog-managed partitions, and these tests pin
that they refuse without moving anything: a registration pointing at a directory
that is gone, or data under a spec nobody registered, would both be worse than
the refusal.
The refusal TRUNCATE PARTITION produced described the table wrongly. "Only
FileStoreTable supports partitions" is reached by a table that has partitions and
lists them through this very trait, which sends the reader looking for the wrong
problem; it now says which operations do manage those partitions.
A null partition value registers under the default partition name, keeps a
directory of that name, reads back as null, is discovered by MSCK REPAIR and is
dropped by that name. SHOW PARTITIONS prints it as dt=null rather than the
default name, which is what Spark's own ShowPartitionsExec does with a null
value; a native Paimon table prints the same thing, so the test records where
that behaviour comes from instead of working around it here.
The remaining probes cover ADD/DROP PARTITION idempotence, prefix DROP, partial
specs in SHOW PARTITIONS, case-insensitive partition column names and empty
string partition values, all of which already behaved this way.
@sundapeng
sundapengforce-pushed the upstream/s7-format-table-partition-operations branch from 88d9b82 to febbaddCompareAugust 12, 2026 07:03
@sundapengsundapeng changed the title [spark] Add tests for catalog-managed Format Table partitions[spark] Add tests and clearer errors for catalog-managed Format Table partitionsAug 12, 2026
@sundapengsundapeng changed the title [spark] Add tests and clearer errors for catalog-managed Format Table partitions[spark] Add Format Table partition operation tests and clearer errorsAug 12, 2026
@JingsongLi

Copy link
Copy Markdown
Contributor

+1

@JingsongLi
JingsongLi merged commit 10efb03 into apache:masterAug 12, 2026
12 checks passed
@sundapeng
sundapeng deleted the upstream/s7-format-table-partition-operations branch August 12, 2026 18:16
Sign up for freeto 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

@sundapeng@JingsongLi@leaves12138