apache / apache/datafusion-python

Expose SessionContext.create_physical_expr for logical-to-physical Expr conversion

Aperta
#1,573 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
604
Fork
174
Merge medio
1g 7h
PR unite (30g)
4

Descrizione

## Background

`SessionContext::create_physical_expr` converts a logical `Expr` against a `DFSchema` into a `PhysicalExpr` that can be evaluated directly against Arrow record batches. The Python bindings do not expose this.

## Upstream signature

```rust
pub fn create_physical_expr(
&self,
expr: Expr,
input_dfschema: &DFSchema,
) -> Result>
```

## User value

Useful when callers want to evaluate an Expr against an in-memory RecordBatch without going through DataFrame execution -- for example to score / filter individual batches in a custom processing loop, to debug optimization rewrites, or to feed an expression into a custom physical operator. Niche but irreplaceable for that audience.

## Why deferred

Effort is small (~180-280 LOC) but requires a new `PyPhysicalExpr` wrapper exposing the opaque `Arc` trait object plus an `evaluate(batch) -> ColumnarValue` method to make it useful from Python. Zero open user requests at the time of audit. Filed for tracking; revisit when a user surfaces a concrete need or when adjacent FFI work pulls `PhysicalExpr` into the binding surface.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start with SessionContext::create_physical_expr and the proposed PyPhysicalExpr entry point; trace how the Python bindings handle Expr, DFSchema, RecordBatch, and ColumnarValue. Done means Python can create a physical expression from an Expr and DFSchema, call evaluate(batch), and receive a ColumnarValue.

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

Valutazione

Stack tecnologico
python, rust
Ambito
api, backend
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.