Avoid re-evaluating expressions in filters and projections
- 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
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