apache / apache/datafusion-python

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

未关闭
#1,573 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
604
派生
174
平均合并
1 天 7 小时
30 天内合并 PR
4

描述

## 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.

贡献指南

这个仓库没有索引到贡献指南

调研方向

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.

由索引模型根据 Issue 内容生成。

评估

技术栈
python, rust
领域
api, backend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。