feat: register extra functions for Lance filter strings

Aperta
#10,887 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
54/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
backend, databases

Direzione di ricerca

Start in lance_datafusion::udf::register_functions and trace how LanceContextProvider obtains sessions through get_session_context. Follow the existing register_scalar_index_plugin registration rule to understand when registrations must happen. Add coverage for planning and running a scanner filter with the registered function, and for preserving it through a Substrait round trip.

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

Descrizione

feature

Summary

An application or an out-of-tree index plugin can't add a function that Lance filter strings can call.

Filter strings (Scanner::filter, count_rows with a filter, and SQL layers built on them) resolve function names through LanceContextProvider. Its default reads the session from get_session_context(&LanceExecutionOptions::default()), which only has the fixed set registered by lance_datafusion::udf::register_functions.

The workarounds don't hold up:

  • Registering into the cached session is unreliable. The session cache is an LRU keyed by execution options, and an evicted entry is rebuilt without the function.
  • A plugin's parser can't help. ScalarQueryParser::visit_scalar_function lets a plugin claim a function call, but a filter string that calls an unknown function fails to plan before any parser sees it.

Proposal

  • Add a process-wide registration, for example lance_datafusion::udf::register_filter_function(Arc<ScalarUDF>).
  • register_functions applies it to every session Lance builds.
  • Follow the same rule as register_scalar_index_plugin: register before the first session is built.

Together with #10111, a scalar index plugin could then ship the function its parser answers.

Tests

  • A filter string that calls a registered function plans and runs through the scanner.
  • The filter survives a Substrait round trip.

Happy to open a PR.

Lingua principale
Rust
Stelle
7.3k
Fork
929
Merge medio
2g 22h
PR unite (30g)
572

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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 lance-format/lance

Tutte le issue di lance-format/lance

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.