datafusion-proto: decoding an AvroScan node without the avro feature panics

Đang mở Phù hợp với người mới
#26,998 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

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

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
85/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
databases

Hướng nghiên cứu

Panic đến từ nhánh #[cfg(not(feature = "avro"))] dành cho AvroScan trong datafusion/proto/src/physical_plan/mod.rs, khoảng dòng 1238-1247. Hãy sao chép nhánh ParquetScan ngay phía trên, nhánh này trả về not_impl_err! cho cùng trường hợp. Hoàn thành khi giải mã một nút AvroScan với tính năng mặc định trả về Err thay vì panic, điều mà một test mới được build không có tính năng avro có thể kiểm tra.

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

Mô tả

Describe the bug

datafusion-proto is built without avro by default, since its default features are ["parquet"]. In that build, PhysicalPlanNode::try_into_physical_plan panics on an AvroScan node:

https://github.com/apache/datafusion/blob/934691e9af8f11bf4b629f21bb17795abfb84d93/datafusion/proto/src/physical_plan/mod.rs#L1238-L1247

#[cfg(not(feature = "avro"))]
panic!(
    "Unable to process a Avro PhysicalPlan when `avro` feature is not enabled"
)

The ParquetScan arm just above it handles the same situation with not_impl_err!:

https://github.com/apache/datafusion/blob/934691e9af8f11bf4b629f21bb17795abfb84d93/datafusion/proto/src/physical_plan/mod.rs#L1228-L1237

The same code is in 55.1.0, src/physical_plan/mod.rs, lines 1100-1108.

To Reproduce

Build datafusion-proto with default features, then decode a PhysicalPlanNode whose physical_plan_type is AvroScan(Default::default()):

let node = protobuf::PhysicalPlanNode {
    physical_plan_type: Some(protobuf::physical_plan_node::PhysicalPlanType::AvroScan(Default::default())),
};
let _ = datafusion_proto::bytes::physical_plan_from_bytes(&node.encode_to_vec(), &ctx.task_ctx());

The arm is an unconditional panic!, so this panics before the node's contents are looked at.

Expected behavior

Return not_impl_err!, as the ParquetScan arm does, so a caller gets Err and keeps running.

Additional context

This matters wherever a process decodes plans it did not encode itself. One example is a distributed worker that receives plan stages from peers. A few bytes of input panic the decoding task, and under panic = "abort" they stop the whole process.

A fix is one line, plus a decode test with the feature off. I can open the PR if that is welcome.

Ngôn ngữ chính
Rust
Star
9.6k
Fork
2.6k
Merge trung bình
4 ngày 5 giờ
Pull request đã merge (30 ngày)
319

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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

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

Issue tương tự

Thêm issue về Rust

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.