[Bug] Spark vector search returns a short top-K when a residual filter is not pushed down

Aperta
#9,931 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java

Direzione di ricerca

Start by tracing SparkV2FilterConverter and PaimonBaseScanBuilder.pushPredicates to see how non-convertible predicates become postScan filters during vector_search. Then inspect the lateral path in PushDownLateralVectorSearchFilter and compare the behavior with issue #9883. Done means residual filters no longer produce incomplete top-k results, either by refusing the pushdown or by refilling results after filtering.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Search before asking
  • I searched in the issues and found nothing similar.
Paimon version

master

Compute Engine

Spark (primary-key / data-evolution vector search via the vector_search TVF)

Minimal reproduce step

Run a Spark vector_search(...) with a LIMIT k, and a WHERE conjunct that SparkV2FilterConverter cannot convert to a Paimon predicate: a UDF call, a column-to-column comparison (a > b), or an unresolvable cast. For example a filter like udf(col) = 1 combined with the vector search, limit = k.

What doesn't meet your expectations?

The result can miss qualifying rows.

The vector search returns exactly k rows, the top-k by vector distance, computed over the pushed-down (convertible) predicates only. A non-convertible conjunct is not pushed into Paimon (PaimonBaseScanBuilder.pushPredicates keeps it in postScan), so Spark applies it as a FilterExec above the already-truncated top-k. Post-filtering the top-k can only drop rows, never refill the ones displaced out of it, so rows that satisfy the residual but ranked just outside the returned k are lost, and the result is short.

This is distinct from #9883, which is about a predicate that reaches Paimon but the scalar index cannot evaluate. Here the predicate never reaches Paimon at all, so the evaluator-level fix in #9883 does not cover it. The Flink vector_search procedure does not have this problem: it parses the whole where string into the Paimon predicate, so an inexpressible conjunct fails the call rather than silently becoming a residual.

Anything else?

Found while tracing the vector-search filter pushdown for #9883. Fix direction: when a vector search has a non-convertible residual, either refuse the pushdown / fail fast, or over-retrieve and re-apply the residual to refill the top-k. The lateral / dynamic-query-vector path (PushDownLateralVectorSearchFilter) has the same exposure.

Are you willing to submit a PR?
  • I'm willing to submit a PR!
Lingua principale
Java
Stelle
3.4k
Fork
1.4k
Merge medio
1g 14h
PR unite (30g)
468

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/paimon

Tutte le issue di apache/paimon

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.