Skip to content

feat(spark): push list predicates into V2 native scans - #117

Open
ChristopherWirt wants to merge 3 commits into
developfrom
cwirt/spark-list-predicate-pushdown
Open

ChristopherWirt wants to merge 3 commits into
developfrom
cwirt/spark-list-predicate-pushdown

Conversation

@ChristopherWirt

@ChristopherWirt ChristopherWirt commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #116.

Problem

  1. Spark V1 Filters cannot express list predicates such as array_contains(tags, 'x') or exists(items, x -> x.price > 100).
  2. So today the V2 scan reads every row and Spark evaluates these predicates afterwards.

Change

  1. Translate. VortexScan turns supported Catalyst ArrayContains / ArrayExists data filters into VortexListFilters, which compile to native listContains / listTransform. Supported inside the predicate: comparisons, AND/OR/NOT, null checks, and struct fields of the element.
  2. Ship. VortexListFilter holds the Catalyst predicate, not native handles. It travels to executors through a small Java NativePredicate interface, because the Java sources compile before the Scala ones.
  3. Validate per file. Each predicate reports the column paths it reads. The reader checks those paths against the file's physical schema, including timestamp units, and drops the predicate for that file if anything doesn't match.
  4. Stay safe. Spark still evaluates every predicate as a residual filter. Floats, non-binary collations, correlated or nested lambdas, and other operators are left to Spark.

Not in scope

  • V1 (VortexFileFormat) pushdown and list-element zone pruning.
  • For array<struct>, any unsupported or missing sibling field in the element struct (a map, or a ms timestamp, for example) disables pushdown for that file. This is conservative, not wrong. Recursing ReadTypes.filterable into arrays would fix it.
  • No performance numbers yet.

Testing

  • Compiles for Spark 3.5 / Scala 2.12, Spark 3.5 / Scala 2.13, and Spark 4.0 / Scala 2.13. spotlessCheck is clean.
  • Passing: all non-JNI unit tests, including the new ReadTypesTest and VortexListFilterTest cases, and the existing V1 VortexFilterPushdownTest cases.
  • Not yet run: the new end-to-end cases need a JNI library with NativeExpression.variable. On current develop the Rust code compiles, but a local build hasn't completed yet. Draft until those cases pass.

🤖 Generated with Claude Code

ChristopherWirt and others added 3 commits November 11, 2026 15:49
Signed-off-by: Christopher Wirt <cwirt@quantcast.com>
- Emit nested field paths from list predicates instead of special-casing
  whole structs in the shared ReadTypes.filterable, which had stopped
  `s.a` filters being pushed alongside Spark's inferred `isnotnull(s)`.
- Share the comparable-type rule between V1 literals and list filters,
  without allocating native expressions to check a type.
- Resolve filterable columns once per file and AND all converted
  filters in one native call.
- Rename the plumbing to nativePredicates and tidy tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…redicate-pushdown

# Conflicts:
#	java/vortex-spark/common/src/main/java/dev/vortex/spark/read/VortexPartitionReader.java
#	java/vortex-spark/common/src/main/java/dev/vortex/spark/read/VortexPartitionReaderFactory.java
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.

Push Spark V2 list-element predicates into native scans

1 participant