Expose SessionContext.add_optimizer_rule for Python-defined logical optimizer rules

Đang mở
#1,574 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python, rust
Lĩnh vực
data-engineering

Hướng nghiên cứu

Bắt đầu bằng cách xem xét binding Python hiện có cho SessionContext.remove_optimizer_rule và phần triển khai add_physical_optimizer_rule trong PR #1557. Xem xét lại issue này khi upstream cung cấp FFI_OptimizerRule và các hàm khởi tạo Python LogicalPlan; được xem là hoàn tất khi các quy tắc logic được định nghĩa bằng Python có thể được đăng ký thông qua add_optimizer_rule và thực thi thông qua binding.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Background

SessionContext::add_optimizer_rule registers an Arc<dyn OptimizerRule> that runs during logical plan optimization. The Python bindings only expose remove_optimizer_rule, never the additive side. PR #1557 ultimately landed add_physical_optimizer_rule for the physical pipeline via FFI but did not address the logical pipeline.

Upstream signature

pub fn add_optimizer_rule(&self, optimizer_rule: Arc<dyn OptimizerRule + Send + Sync>)

User value

Lets users add domain-specific logical rewrites (predicate normalization, redundant join elimination, scan pruning informed by external metadata) without forking DataFusion. Complements the existing remove_optimizer_rule to round out the surface.

Why deferred

Blocked upstream. As documented in PR #1557, DataFusion does not currently expose an FFI bridge for the logical OptimizerRule / AnalyzerRule traits, and there are no Python constructors for LogicalPlan node variants -- a pure-Python rule could observe plans but not transform them. The PR #1557 commit history shows an initial attempt at a Python-defined logical rule that was abandoned for this reason. This is filed for tracking; it should be revisited once upstream lands an FFI_OptimizerRule (mirroring FFI_PhysicalOptimizerRule).

Ngôn ngữ chính
Python
Star
605
Fork
176
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
8

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/datafusion-python

Tất cả issue của apache/datafusion-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.