Skip to content

[spark] Partition metadata fails on chain and query-authorized reads - #10838

Open
taoran92 wants to merge 1 commit into
apache:masterfrom
taoran92:fix/spark-partition-metadata
Open

taoran92 wants to merge 1 commit into
apache:masterfrom
taoran92:fix/spark-partition-metadata

Conversation

@taoran92

@taoran92 taoran92 commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Purpose

Fixes #10837.

Spark queries that project or filter __paimon_partition currently fail on chain tables and query-authorized reads. Build partition metadata from visible reader rows so retained snapshot rows report the logical chain partition, while authorized reads preserve row filters, column permissions and column masks, including masks that depend on another field or return NULL.

Read and authorize the requested metadata subfields, then remove any added ordinary fields from the Spark output. Preserve nested pruning and nullable masked partition fields, and keep fields added only for metadata out of ordinary runtime-filter attributes. Document the authorization scope when nested schema pruning is disabled.

Tests

Passed locally with Spark 3.5.8 and JDK 11:

  • SparkPartitionMetadataAuthTest and SparkChainTableMetadataTest: 22 cases covering ordinary, chain and fallback reads, row filters, denied columns, constant/field-dependent/NULL masks, both nested-pruning settings, metadata predicates, aggregates, limits, joins, typed partitions and blob descriptors.
  • SplitUtilsQueryAuthTest: 4 cases covering visible partition values, split wrappers and reader cleanup.
  • 16 additional SQL assertions covering Parquet, ORC and Avro, typed and NULL partitions, empty partition structs, mixed metadata projections, and NULL-mask counts and JSON output.

@taoran92
taoran92 marked this pull request as ready for review October 27, 2026 16:18
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] Spark partition metadata queries fail for chain tables and query-authorized reads

1 participant