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
pub fn create_physical_expr(
&self,
expr: Expr,
input_dfschema: &DFSchema,
) -> Result<Arc<dyn PhysicalExpr>>
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<dyn PhysicalExpr> 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.
Background
SessionContext::create_physical_exprconverts a logicalExpragainst aDFSchemainto aPhysicalExprthat can be evaluated directly against Arrow record batches. The Python bindings do not expose this.Upstream signature
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
PyPhysicalExprwrapper exposing the opaqueArc<dyn PhysicalExpr>trait object plus anevaluate(batch) -> ColumnarValuemethod 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 pullsPhysicalExprinto the binding surface.