Skip to content

[lake/paimon] Validate primary-key imports and bucket keys - #5403

Merged
luoyuxia merged 1 commit into
apache:mainfrom
luoyuxia:fix/paimon-import-validation
Nov 27, 2026
Merged

luoyuxia merged 1 commit into
apache:mainfrom
luoyuxia:fix/paimon-import-validation

Conversation

@luoyuxia

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: Part of #4846.

Reject Paimon primary-key imports whose merge engines or KV value layouts cannot be built by BulkLoad, before creating Fluss database/table metadata. Accept equivalent implicit and explicit Paimon bucket keys when enabling lake access; previously a source without bucket-key could be rejected against the generated bucket-key=id schema.

This is an independently reviewable prerequisite extracted from #5400, based on main.

Brief change log

  • Validate newly imported primary-key tables after merging caller options and before metadata creation. Reject merge engines, row TTL and tagged KV layouts; retain append-only import behavior.
  • Compare ordered, resolved TableSchema.bucketKeys() alongside primary and partition keys. Keep immutable-option validation and legacy-layout compatibility without rewriting source options.
  • Cover native and caller-supplied unsupported options, unchanged source tables after rejection, and real procedure enablement with an implicit default bucket key.

Tests

  • 60 targeted tests passed: 14 CreateTableFromLakeITCase variants, 37 PaimonLakeCatalogTest schema/alter variants, and 9 EnableFlussOnLakeTableProcedureITCase variants.
  • Before the fix, all eight selected regressions failed: six unsupported imports were accepted, and both real enablement cases rejected the implicit default bucket key. Those cases pass with the fix.
  • Checkstyle and Spotless passed for the affected modules. The full test suite was not run.

API and Format

createTableFromLake now rejects unsupported primary-key configurations before creating metadata. Internal compatibility methods accept Paimon TableSchema objects. No public SDK signatures, RPC messages or persisted formats change.

Documentation

No new feature or configuration. The code comment explains why resolved bucket keys are checked as schema metadata instead of comparing raw option values.

Reject primary-key imports with unsupported merge engines, row TTL or
tagged KV layouts before creating database or table metadata.

Compare resolved ordered Paimon bucket keys as physical schema metadata
so implicit and equivalent explicit defaults are compatible. Preserve
immutable option and legacy schema checks.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 106/106
AI-Contributed/UT: 597/597
@luoyuxia
luoyuxia requested a review from beryllw November 27, 2026 12:42

@beryllw beryllw 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 fix!

throw new TableAlreadyExistException("Table " + tablePath + " already exists.");
}

validateBulkLoadSupport(tablePath, tableDescriptor);

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.

Could we run this check only when the source table has a snapshot? Tables without a snapshot skip BulkLoad, and this check now prevents some of those tables from being enabled.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I’d prefer to keep this validation unconditional, so the supported configurations for createTableFromLake don’t depend on the source’s current snapshot state. This intentionally excludes some existing empty tables. For new empty tables, users can create them through Fluss and let Fluss create the Paimon table.

@luoyuxia
luoyuxia merged commit cb456fc into apache:main Nov 27, 2026
20 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