Skip to content

[python] Reject an empty sequence.field on CREATE and ALTER SET - #11640

Open
taoran92 wants to merge 2 commits into
apache:masterfrom
taoran92:fix/python-empty-sequence-field
Open

taoran92 wants to merge 2 commits into
apache:masterfrom
taoran92:fix/python-empty-sequence-field

Conversation

@taoran92

@taoran92 taoran92 commented Dec 2, 2026

Copy link
Copy Markdown
Member

Purpose

Fixes #11639

PyPaimon accepts and saves an empty sequence.field on CREATE and ALTER SET. On a table ordered by ts, setting the option to an empty string can change which row is returned without writing any new data because pure Python reads fall back to the default record ordering.

Reject the explicit empty string before publishing the schema. A rejected ALTER preserves the previous schema and ordering. Users can omit or remove the option to use the default record ordering.

Tests

  • Added regressions for CREATE and ALTER SET rejection, preservation of the previous schema, and removal of an empty option from existing table metadata.
  • Ran the schema manager, filesystem catalog, primary-key schema evolution, and sequence-field read and write suites in pure Python execution mode. All 194 tests passed.
  • Verified that a rejected ALTER on a populated table preserves the selected row and that removing the empty option from an affected table restores DataFusion reads.

@taoran92
taoran92 marked this pull request as ready for review December 2, 2026 15:14

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

[P2] Allow unrelated ALTERs on tables with a legacy empty option

The new check runs on the complete resulting schema. It therefore also rejects unrelated ALTERs when the table already has a persisted sequence.field='' from a previous PyPaimon release. I recreated the legacy schema the same way as the removal test and applied SetOption('write-only', 'true'). The original validator accepted it and published schema 1. This head rejects it and leaves schema 0.

Please reject explicitly setting the empty string on CREATE or ALTER SET, while allowing an unrelated ALTER to preserve an already-stored value. The existing REMOVE recovery path can still clear it. This is independent of the whitespace/comma follow-up. All 194 selected pure Python tests passed.

@taoran92

taoran92 commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

[P2] Allow unrelated ALTERs on tables with a legacy empty option

The new check runs on the complete resulting schema. It therefore also rejects unrelated ALTERs when the table already has a persisted sequence.field='' from a previous PyPaimon release. I recreated the legacy schema the same way as the removal test and applied SetOption('write-only', 'true'). The original validator accepted it and published schema 1. This head rejects it and leaves schema 0.

Please reject explicitly setting the empty string on CREATE or ALTER SET, while allowing an unrelated ALTER to preserve an already-stored value. The existing REMOVE recovery path can still clear it. This is independent of the whitespace/comma follow-up. All 194 selected pure Python tests passed.

Thanks for catching this, fixed with a new commit. CREATE and explicit ALTER SET reject sequence.field='' now. Unrelated ALTERs can preserve the legacy value, and REMOVE still clears it.

taoran92 added a commit to taoran92/paimon that referenced this pull request Dec 5, 2026
@taoran92
taoran92 force-pushed the fix/python-empty-sequence-field branch from f90a93a to 13d98b3 Compare December 5, 2026 13:28
@taoran92 taoran92 closed this Dec 6, 2026
@taoran92 taoran92 reopened this Dec 6, 2026

@Akash3121 Akash3121 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 the update!

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.

[Bug] PyPaimon accepts an empty sequence.field on CREATE and ALTER SET

3 participants