`convert_filters_to_predicate` negates a weakened AND, producing a predicate that drops matching rows

Đang mở
#44 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

@terbed đang làm issue này rồi.

Từ ngày 11/10/2026.

  • #59 của @terbed — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
72/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, sql
Lĩnh vực
databases

Hướng nghiên cứu

Start in crates/datafusion/src/physical_plan/expr_to_predicate.rs, especially the AND handling at lines 370-382 and Expr::Not at lines 89-105. Reproduce the issue with the provided NOT (a = 1 AND upper(b) = 'X') expression, then verify that conversion returns None or only a predicate implied by the original filter.

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

Mô tả

bug
Describe the bug

When one side of an AND can't be converted, to_iceberg_and_predicate keeps only the other side (expr_to_predicate.rs#L370-L382). On its own that is fine for Inexact pushdown, because the result is weaker than the filter. Expr::Not then negates whatever its child produced (expr_to_predicate.rs#L89-L105). Negating a weaker predicate gives a stronger one, which rejects rows the original filter accepts.

To Reproduce
// schema: a INT, b STRING
let expr = SessionContext::new().parse_sql_expr("NOT (a = 1 AND upper(b) = 'X')", &df_schema)?;
let predicate = convert_filters_to_predicate(&[expr]);
// Some(NOT (a = 1)): drops a = 1, b = 'y', which the filter keeps
Expected behavior

The result is None, or another predicate implied by the filter. One way is to track whether each converted sub-predicate is exact, and negate only exact ones.

Additional context

SQL doesn't trigger this today with the default optimizer. DataFusion's simplifier rewrites NOT (A AND B) to NOT A OR NOT B before pushdown, so nothing is pushed for this filter. convert_filters_to_predicate is public, though, so other callers can hit it, as can any plan whose filters reach the scan without simplification. NOT (flag AND a = 1) on a boolean column has the same problem.

Ngôn ngữ chính
Rust
Star
33
Fork
34
Merge trung bình
4 ngày 14 giờ
Pull request đã merge (30 ngày)
10

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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-iceberg

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

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.