Use `Array::to_arc` instead of `make_array(x.to_data())` and `x.slice(0, x.len())`
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ó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Tái cấu trúc
- Độ 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
- backend, performance
Hướng nghiên cứu
Có bốn điểm gọi được nêu tên kèm liên kết đến dòng mã: datafusion/physical-expr-common/src/datum.rs, datafusion/physical-expr/src/expressions/in_list/array_static_filter.rs, datafusion/physical-expr-common/src/utils.rs và datafusion/physical-plan/src/spill/spilled_row_sizes.rs (trường hợp dictionary.keys(), có thể cần keys.to_arc() trên node con). Trước hết, hãy xác nhận phiên bản arrow đã ghim trong Cargo.toml của workspace đã cung cấp Array::to_arc; nếu chưa, việc nâng cấp phụ thuộc là điều kiện tiên quyết. Hoàn thành khi mọi cách xử lý tạm thời được thay bằng x.to_arc() và cargo test chạy thành công cho các crate bị ảnh hưởng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Is your feature request related to a problem or challenge?
arrow-rs adds Array::to_arc in apache/arrow-rs#12420, and it is expected to ship in arrow 60.3.0 or 61.0.0. It returns an ArrayRef that shares the buffers of a &dyn Array. When the &dyn Array is an &ArrayRef, it returns a new reference to the same allocation.
DataFusion has four places outside tests that turn a &dyn Array into an ArrayRef with a workaround:
make_array(array.to_data())innormalize_nested_float_zero: https://github.com/apache/datafusion/blob/dbb98dedc329a296a5153019b5ccfdf260088c3f/datafusion/physical-expr-common/src/datum.rs#L128-L131make_array(v.to_data())inArrayStaticFilter::contains: https://github.com/apache/datafusion/blob/dbb98dedc329a296a5153019b5ccfdf260088c3f/datafusion/physical-expr/src/expressions/in_list/array_static_filter.rs#L132truthy.slice(0, truthy.len())in the all-true fast path ofscatter: https://github.com/apache/datafusion/blob/dbb98dedc329a296a5153019b5ccfdf260088c3f/datafusion/physical-expr-common/src/utils.rs#L80-L82make_array(dictionary.keys().to_data())inColumnSize::new: https://github.com/apache/datafusion/blob/dbb98dedc329a296a5153019b5ccfdf260088c3f/datafusion/physical-plan/src/spill/spilled_row_sizes.rs#L158
make_array(x.to_data()) builds an ArrayData and then rebuilds a typed array from it, and nested types repeat that for every child. slice(0, len) recounts the null buffer's nulls and re-slices the children of nested types. to_arc clones an arrow-rs array into a new Arc, and for an ArrayRef it only increments the reference count.
Describe the solution you'd like
After DataFusion upgrades to an arrow release that includes Array::to_arc, replace each workaround above with x.to_arc().
Describe alternatives you've considered
We could keep the workarounds. They return equal arrays but do more work per call.
Additional context
The same arrow-rs PR switches arrow's own cast, concat, nullif, and shift from these workarounds to to_arc.
- Ngôn ngữ chính
- Rust
- Star
- 9.6k
- Fork
- 2.7k
- Merge trung bình
- 3 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 318
Chuẩn bị môi trường
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.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/datafusion
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
apache/datafusion#27688 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`verify-release-candidate.sh` version check doesn't catch `-dev` versions and is skipped on macOSCó thể đã có người làm @vinycalves đã nhận 5 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/datafusion#27563 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`MoveTowardsLeafNodes` placement implies speculative evaluation, but the docs don't say soCó thể đã có người làm @Inf1mum đã nhận 6 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
apache/datafusion#27487 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`lpad` and `rpad` with a literal length above `i32::MAX` error on a NULL string or fillCó thể đã có người làm @TechWizard9999 đã nhận 6 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
apache/datafusion#27482 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Window constructors panic when the expression list is emptyCó thể đã có người làm @abp002 đã nhận 9 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/datafusion#27315 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/datafusion
Issue tương tự
-
ai_p1 comp-sql-syntax
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
ClickHouse/ClickHouse#133888 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
horizon-rust/horizon#20542 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
LadybirdBrowser/ladybird#15521 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
macOS: the Save Diagnostics panel goes behind the editor after an app switch and can't be reachedĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
getopenscreen/openscreen#1667 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
erkamyaman/rust-anything#371 ·
Maintainer thường phản hồi trong vòng 1 ngày