Skip to content

[spark] Reject empty partition values for format tables - #9436

Merged
JingsongLi merged 1 commit into
apache:masterfrom
sundapeng:upstream/format-table-reject-empty-partition
Aug 28, 2026
Merged

[spark] Reject empty partition values for format tables#9436
JingsongLi merged 1 commit into
apache:masterfrom
sundapeng:upstream/format-table-reject-empty-partition

Conversation

@sundapeng

@sundapeng sundapeng commented Aug 27, 2026

Copy link
Copy Markdown
Member

Purpose

Partition DDL accepted a string that names no partition. Paimon writes an empty or whitespace-only partition value to the default partition name, the same place a NULL goes. InternalRowPartitionComputer decides that with StringUtils.isNullOrWhitespaceOnly. So ADD PARTITION (dt = '') registered a partition under a name its own value cannot round-trip to, and DROP PARTITION (dt = '') and TRUNCATE PARTITION (dt = '') silently hit the null partition and deleted its data.

All three now reject such a value with an IllegalArgumentException naming the column, the table and the default partition name. The whole batch is validated before anything is registered or created, so one bad spec fails without leaving the others half applied. NULL is untouched, and so is the write path: an empty value arriving through INSERT still lands in the default partition.

Tests

CatalogManagedPartitionEdgeParityTest: 19 tests passed.

@sundapeng
sundapeng force-pushed the upstream/format-table-reject-empty-partition branch from 1d06e4a to 335a482 Compare August 28, 2026 03:41
@sundapeng sundapeng changed the title [spark] Reject empty ADD PARTITION values for format tables [spark] Reject empty partition values for format tables Aug 28, 2026
@sundapeng sundapeng closed this Aug 28, 2026
@sundapeng sundapeng reopened this Aug 28, 2026
@JingsongLi

Copy link
Copy Markdown
Contributor

+1

@JingsongLi
JingsongLi merged commit 1c3df8f into apache:master Aug 28, 2026
24 of 26 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.

2 participants