Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Decode Python UDFs opaquely so a scheduler needs no Python interpreter

Đang mở
#1,705 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
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python, rust

Hướng nghiên cứu

Bắt đầu bằng cách đọc crates/core/src/codec.rs và phần công việc về codec mở rộng từ #1678 để hiểu wire format của DFPYUDF và cách kết hợp các codec. Thiết kế ScalarUDFImpl và codec phía scheduler dựa trên payload hiện có, giữ nguyên các byte cloudpickle trong quá trình mã hóa lại, đồng thời cung cấp metadata có thể khôi phục và khiến invoke trả về lỗi. Kiểm tra ngữ cảnh dependency trong #1703.

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

Mô tả

enhancement rust

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

In a distributed setup the scheduler plans a query and hands stages to executors; only the executors ever call a Python UDF. Decoding an inlined Python UDF unpickles the function, which requires a Python interpreter and every module the function closes over to be importable. Doing that on the scheduler costs work nobody needs and forces the scheduler image to carry Python and the full dependency set of user code it will never run. Raised in https://github.com/apache/datafusion-python/pull/1678#pullrequestreview-5100366976.

Describe the solution you'd like

An opaque decode path: a ScalarUDFImpl that holds the still-pickled blob rather than a live Python object, and a codec that produces it. A scheduler installs that codec, decodes a plan into something it can inspect, route, and re-encode, and never touches cloudpickle. The executor installs the ordinary codec and unpickles as it does now.

The wire format already allows this. An inlined UDF payload is DFPYUDF followed by a version byte and the cloudpickle blob (crates/core/src/codec.rs), so an opaque holder can carry those bytes verbatim and no format change is needed.

The part that needs design is re-encoding. A scheduler that forwards a stage has to emit the blob byte-identically, so the executor sees exactly what the client wrote. That also raises what such a UDF should report for the things DataFusion asks of a ScalarUDFImpl during planning — name, signature, and return type are all recoverable from the payload without unpickling, since they are stored alongside the function, but invoke has to be an error rather than a surprise.

Describe alternatives you've considered

Encoding Python UDFs by name only and registering them on every node. Already supported and appropriate when the function is available everywhere; it does not cover the case inlining exists for, which is a function the receiving process does not have.

Having the scheduler unpickle and immediately drop the object. Keeps the code simple, and still requires Python plus all user dependencies on the scheduler, which is the actual cost being avoided.

Additional context

Follow-up from #1678, which made extension codecs compose so a setup like this can install a scheduler-side codec alongside others. Likely also depends on #1703, gating pyo3/extension-module, if the consumer is a Rust crate rather than a Python process.

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.