Skip to content

[Python] Align Native write validation and file metadata with Java - #10660

Merged
JingsongLi merged 11 commits into
apache:masterfrom
JingsongLi:codex/native-custom-io-auth-partitions
Oct 19, 2026
Merged

JingsongLi merged 11 commits into
apache:masterfrom
JingsongLi:codex/native-custom-io-auth-partitions

Conversation

@JingsongLi

@JingsongLi JingsongLi commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Align existing PyPaimon Native write validation, binary partition naming and data-file creation-time semantics with current Java, and remove unnecessary Native fallback caused by unused context fields.

Depends on apache/paimon-rust#1172 for the corresponding Native behavior fixes. Native CI continues building Rust main; this PR remains draft until the Rust fixes land.

Brief change log

  • Let Rust own Native payload normalization after row-kind filtering. The Python facade checks compatible logical schemas without inspecting ignored nested values.
  • Apply Java's top-level NOT NULL checks before filtering on Python Arrow/InternalRow paths, including the deduplicate DELETE exception for non-key/non-sequence fields.
  • In the Python writer, filter first and then convert LargeString inputs and retain strict nested-schema validation for surviving values; preserve schema-only writer behavior and existing Arrow transport metadata. Native passes STRING offset layouts to Core without rebuilding payload arrays in Python.
  • Keep Pandas DELETE payloads available until Java-equivalent row-kind NULL checks and filtering. Only filtering PK writers use a nullable top-level transport schema; logical NOT NULL declarations, nested fields, metadata and non-filtering writer checks are preserved.
  • Add actual ARRAY/ROW/MAP write/read regressions for ignored DELETE/UPDATE_BEFORE, automatic/precomputed buckets and invalid retained values, plus batch/stream NULL-check and thin-facade regressions.
  • Fix Java BINARY/VARBINARY legacy partition names: byte[].toString() used allocation identity and produced different paths for the same contents. Use the existing UTF-8 cast in both naming modes, preserving other legacy types. Align Python and remove obsolete Native binary-partition exclusions.
  • Resolve data-file creation fields in the system time zone for REST statistics, preserving exact milliseconds and Java DST gap/overlap behavior.
  • Preserve epoch zero and negative partition creation times; verify multiple-file maxima in both input orders through real REST commits.
  • Take INPUT changelog creation times after the file write, independently of precomputed row statistics; verify batch/stream writes with an advancing deterministic clock.
  • Preserve integer millisecond precision when Avro exposes serialized local TIMESTAMP fields as UTC datetimes.
  • Match Java writer factories' TIMESTAMP(3) precision for append, PK/input changelog, postpone, dedicated Blob and Parquet vector files. Explicitly supplied factory timestamps remain unchanged.
  • Update the existing PK manifest timestamp assertion to resolve local wall fields once and retain exact milliseconds.
  • Keep Native commit and vector-search eligibility when unused hadoop_conf/prefer_io_loader/fallback_io_loader context fields are present.
  • Remove the proposed custom query_auth integration, factory/session state plumbing and dedicated tests. Existing standard REST authorization, eligibility checks and custom-hook Python fallback remain in place. The earlier general Python FileIO bridge is also removed.

Tests

  • Review follow-up: real LargeString Arrow write/commit/read regressions and Pandas row-kind/nullability regressions first fail on the old code, then pass. Final focused suite: 56 passed, 44 Native skipped; adjacent writer/schema suites: 207 passed, 169 skipped, 6 subtests passed. Invalid retained INSERTs, PK/sequence NULLs and ordinary append/PK Pandas constructor checks remain covered.

  • Before the final Pandas-only transport adjustment, full related write/schema/Python 3.6 regressions: 437 passed, 392 skipped, 33 subtests passed. The final changed Python sources pass Flake8, Python 3.6 syntax parsing and diff checks.

  • Additional Native NULL-transport regressions: 39 passed, 24 Native skipped locally; real PyArrow C Data and WriteState checks pass in the companion Rust binding unit executable (101 tests).

  • New ignored nested-value write/read matrix: 15 passed, 15 Native skipped locally.

  • Related write/schema/Python 3.6 regressions: 418 passed, 349 skipped, 33 subtests passed.

  • Independent review caught and closed LargeUtf8, InternalRow kind, retained nested-schema and schema-only writer edge cases.

  • New related writer regressions: 135 passed, 8 subtests; commit/creation-time regressions: 58 passed, 3 Native skipped, 10 subtests (one unrelated optional Lance case deselected).

  • Final creation-time regression rerun (both file orders): 22 passed, 6 Native skipped.

  • Previously verified related Python regressions: 247 passed, 234 Native skipped, 44 subtests passed. Restored Native-plan regression suite: 68 passed, 44 subtests passed.

  • Standard REST authorization and custom-hook fallback, commit, Native vector context, binary partitions, real REST creation-time statistics, exact Avro timestamps and Pure writer metadata roundtrips.

  • Java InternalRowPartitionComputerTest: 5 passed; Java sources are unchanged since the verified Checkstyle/Spotless run.

  • All changed Python files pass repository Flake8 and Python 3.6 syntax parsing; diff checks pass.

  • Companion Rust core, writer and Python-binding Rust unit suites plus pinned Clippy and rustfmt.

  • Local Python tests did not rebuild or install the Native extension. Native cases remain enabled for CI with the Rust behavior fixes.

@JingsongLi JingsongLi changed the title [Python] Support native mutations with resolved FileIO and custom authorization [Python] Complete native catalog authorization and mutation metadata alignment Oct 19, 2026
@JingsongLi JingsongLi changed the title [Python] Complete native catalog authorization and mutation metadata alignment [Python] Align binary partitions and mutation timestamps with Java Oct 19, 2026
@JingsongLi JingsongLi changed the title [Python] Align binary partitions and mutation timestamps with Java [Python] Align Native write validation and file metadata with Java Oct 19, 2026
@JingsongLi
JingsongLi marked this pull request as ready for review October 19, 2026 14:08

@leaves12138 leaves12138 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

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