Skip to content

feat(read): support predicates on non-projected fields - #599

Merged
lxy-9602 merged 5 commits into
apache:mainfrom
lszskye:unbind_predicate_field_in_projection
Dec 4, 2026
Merged

lxy-9602 merged 5 commits into
apache:mainfrom
lszskye:unbind_predicate_field_in_projection

Conversation

@lszskye

@lszskye lszskye commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Purpose

Remove the requirement that predicate fields must appear in the output projection. For example, a read can now return only name while filtering on age, without exposing age in the result. This also applies to full-text predicate fields.

Introduce ReadSchemaPlan to separate the requested output schema from the internal schema containing predicate and authorization dependencies. Use ProjectionBatchReader to remove these dependencies after filtering, merging, or masking. Apply this consistently across append, primary-key, data-evolution, realtime, precise-index, query-auth, and format-table reads.

The change also addresses several predicate-handling issues:

  • AbstractSplitRead: Pass only predicates on fields present in the data schema to file-index evaluation, excluding virtual system fields. Preserve the original predicate for subsequent reading and filtering.
  • CompleteRowTrackingFieldsBatchReader: Stop pushing predicates on missing _ROW_ID and _SEQUENCE_NUMBER columns into the physical format reader. Keep these predicates for the existing filtering stage after the values are completed. Predicates on columns already present in the file remain eligible for pushdown.
  • FileStoreScan: Exclude predicates requiring virtual row-tracking fields from manifest-statistics pruning. Drop the entire affected conjunct, including mixed OR expressions, to avoid incorrectly pruning matching files.
  • Predicate validation: Remove field-index equality checks while retaining field existence, type, and literal validation. Bind execution positions by field name so existing callers using projection-relative indices remain compatible.

Tests

Add or update coverage for:

  • Unprojected data and partition predicates in append and primary-key reads, including schema evolution.
  • Data-evolution, precise scalar/full-text index reads, score output, and realtime disk/memory reads.
  • Realtime deduplication and primary-key merging before filtering and projection.
  • Query-auth predicates on unprojected masked columns and format-table predicates on unprojected columns.
  • Projection behavior with selection bitmaps, dictionary arrays, metadata, nulls, and empty projections.

API and Format

No public API signature, storage format, or protocol changes.

Documentation

Update predicate API comments and the file-index, realtime, and format-table guides to describe predicates on non-projected fields.

Generative AI tooling

Generated-by: OpenAI Codex (GPT-6)

@SteNicholas SteNicholas left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@lszskye, I left two comments for read correctness issues. PTAL.

@SteNicholas SteNicholas left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@lszskye, I left some comments on the GCC build failure and the sequence-number predicate behavior in append reads and primary-key merges. PTAL.

@lxy-9602 lxy-9602 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@SteNicholas SteNicholas left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@lxy-9602
lxy-9602 merged commit b83b8ad into apache:main Dec 4, 2026
18 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.

3 participants