Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Expose SessionContext.register_variable / deregister_variable for SQL @var support

Aperta
#1,571 0 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
38/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
python, rust
Ambito
api, backend

Direzione di ricerca

La issue cita PySessionContext, un wrapper Rust di PyVarProvider e un ABC rivolto a Python, ma non include file né test. Inizia tracciando i binding esistenti di PySessionContext e le firme di register_variable e deregister_variable di SessionContext upstream. L'attività è completata quando i chiamanti Python possono fornire un VarProvider, registrarlo e deregistrarlo, e ricevere callback in modo sicuro oltre il confine del GIL.

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

Descrizione

Background

DataFusion's SessionContext exposes register_variable(var_type, provider) and deregister_variable(var_type) for plugging in a VarProvider that resolves SQL @var / @@var references at execution time. These were surfaced during a v54 upstream coverage audit but are not exposed in the Python bindings.

Upstream signature

pub fn register_variable(&self, var_type: VarType, provider: Arc<dyn VarProvider + Send + Sync>)
pub fn deregister_variable(&self, var_type: VarType) -> Option<Arc<dyn VarProvider + Send + Sync>>

VarProvider is a small trait with get_value(&self, name: Vec<String>) -> Result<ScalarValue> and get_type(&self, name: &[String]) -> Option<DataType>.

User value

Enables SQL like SELECT * FROM sales WHERE region = @current_region AND user_id = @user_id where the provider supplies per-query values. Useful for multi-tenant SaaS embedders, BI / notebook tools that want session-scoped parameters without f-string interpolation (no SQL injection risk), and tools porting MySQL / Postgres SQL that uses session variables.

Why deferred

Effort estimate is medium (~250-400 LOC): needs a PyVarProvider Rust wrapper that calls back into a user-supplied Python object across the GIL boundary, plus the register / deregister bindings on PySessionContext, plus a Python-facing ABC. No open user requests at the time of audit, so the work is currently speculative. Filed for tracking; revisit when a concrete user need surfaces or to complete the upstream surface area.

Lingua principale
Python
Stelle
605
Fork
176
Merge medio
1g 23h
PR unite (30g)
8

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/datafusion-python

Tutte le issue di apache/datafusion-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.