Skip to content

spark: prune struct fields inside arrays (blocked on list layout) #16

Closed

Description

@ChristopherWirt

Goal

Extend nested schema pruning (#9, #10) to struct fields inside arrays. For example, SELECT a.f3 FROM t where a is array<struct<...>> should read only f3.

Why it's blocked

Pruning only saves I/O when the file stores a list column with the list layout (vortex.list), which keeps the elements as their own layout tree.

  • vortex.list is only in the unstable edition (vortex-edition/src/declarations/unstable/mod.rs).
  • The JNI session enables only CORE_2026_08_3 (vortex-jni/src/session.rs), so Spark writes every list column as a single flat leaf.
  • Reading any element field of a flat leaf reads the whole list segment, so there's nothing to prune.

Work once vortex.list is in an edition we enable

  1. List reader pushdown (vortex-layout/src/layouts/list/reader.rs): read list_transform($, λ) as offsets and validity plus λ evaluated by the elements reader, for lambdas that can't fail. Today it reads every element and applies the lambda afterwards.
  2. mask marked infallible, so Spark's mask(pack(...), is_not_null(x)) lambdas qualify for (1).
  3. Struct reader: accept list_transform over a single field in the direct-projection path.
  4. JNI: Expression.variable and Expression.listTransform.
  5. Spark: NestedSchemaPruning builds list_transform for ArrayType(StructType). Maps can follow.

Upstream risk

list_transform landed in vortex-data#10503. The open draft vortex-data#10696 proposes a different design for higher-order functions; if it's chosen, steps 1, 3 and 4 change shape.

Activity

  1. gitRasheed commented on Oct 28, 2026

    @gitRasheed
    Collaborator

    Status check, 2026-10-28. Still blocked.

    Nothing to do here until vortex.list lands in an edition we enable. I'll recheck when either upstream draft moves.

  2. ChristopherWirt commented on Nov 2, 2026

    @ChristopherWirt
    CollaboratorAuthor

    Resolved on develop by #35, incorporating #42, with list-layout edition isolation subsequently merged in #57. Spark now generates native list-transform projections for struct fields inside arrays when files use vortex.listLayout=true. VortexNestedSchemaPruningIoTest covers array-element field I/O pruning and nested/null/empty-array correctness against unpruned reads and Parquet. Flat-layout files correctly remain whole-leaf reads, as described in this issue. Confirmed against develop abb4830 by source and existing regression inspection; no tests were rerun for this audit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions