apache / apache/datafusion

Avoid re-evaluating expressions in filters and projections

Đang mở
#17,599 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
9.3k
Fork
2.4k
Merge trung bình
3 ngày 11 giờ
Pull request đã merge (30 ngày)
360

Mô tả

This patterns shows up pretty often:

```sql
select expensive(col)
from t
where expensive(col)
```

A pathological case is variant / json:

```sql
select variant_get(col, 'key')
from t
from variant_get(col, 'key')
```

There's two issues here:
1. Until we solve projection pushdown (https://github.com/apache/datafusion/issues/14993) if `key` is not shredded we materialize the entire `col` and then extract `key` in a `ProjectionExec`.
2. Even once that is resolved, or in the case that `key` is not shredded evaluating `variant_get(col, 'key')` itself is expensive we still re-compute `variant_get(col, 'key')` twice: once for the filter and once for the projection.

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

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách đọc hành vi lọc và projection được mô tả trong các ví dụ SQL, bao gồm ProjectionExec và issue projection-pushdown #14993. Xác định cách các biểu thức lặp lại như variant_get(col, 'key') được biểu diễn và đánh giá, sau đó định nghĩa việc hoàn thành là tránh đánh giá trùng lặp trong khi vẫn giữ nguyên kết quả truy vấn.

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

Đánh giá

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

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.