BaselineMetrics output_bytes converts every column to ArrayData for every batch
Maintainer thường phản hồi trong vòng 1 ngà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ính năng
- Độ 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
- performance
Hướng nghiên cứu
Bắt đầu tại datafusion/physical-expr-common/src/metrics/baseline.rs và đọc RecordOutput::record_output cùng với get_record_batch_memory_size để xem output_bytes được ghi nhận như thế nào. So sánh cách tiếp cận đề xuất dùng Array::get_array_memory_size với cách tính hiện tại cho các bộ đệm dùng chung. Hoàn thành khi việc ghi nhận byte đầu ra không còn chuyển đổi các cột thành ArrayData, trong khi get_record_batch_memory_size vẫn dùng được để tính bộ nhớ.
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?
Every operator's BaselineMetrics records output_bytes for every output batch through RecordOutput::record_output (datafusion/physical-expr-common/src/metrics/baseline.rs), which calls get_record_batch_memory_size. That function converts each column, and each child of a nested column, to ArrayData and inserts every buffer's address into a HashSet, so that buffers shared between columns are counted once. Exact accounting matters for memory reservations; for a per-batch metric it is a cost every query pays, and it grows with the width and nesting of the schema rather than with the data.
Measured on main (c0e872f), release build, Apple M1 Max, one batch of Int32 struct columns:
| batch | get_record_batch_memory_size |
sum of Array::get_array_memory_size |
|---|---|---|
| 35 struct columns x 20 fields, 100 rows | 21.9 µs | 1.6 µs |
| 35 struct columns x 20 fields, 4,000 rows | 15.1 µs | 1.5 µs |
| 5 struct columns x 5 fields, 4,000 rows | 0.58 µs | 0.05 µs |
That is per operator per batch. We hit it running one wide plan repeatedly (a game's world, 35 struct columns, a few thousand rows, a few hundred operators, through Sail on DataFusion 55.1): in a sampled profile, BaselineMetrics::record_poll -> get_record_batch_memory_size -> StructArray::to_data was about 12% of executing the plan, and computing the metric as below took a run from 40 ms to 34 ms.
Describe the solution you'd like
Compute output_bytes without ArrayData, for example:
fn output_bytes(batch: &RecordBatch) -> usize {
batch.columns().iter().map(|c| c.get_array_memory_size()).sum()
}
This can count a buffer shared between columns more than once (in the table above it reports 350,840 bytes against 280,000 for the 100-row batch, which shares nothing; the difference is the arrays' own structures), which seems acceptable for a metric; get_record_batch_memory_size would stay for memory accounting. Alternatively, output_bytes could be computed only when a metrics level that shows it is requested.
Describe alternatives you've considered
Making get_record_batch_memory_size itself cheaper for nested arrays (walking the arrays' buffers without building ArrayData) would help memory accounting too, but keeps the hash set per batch.
Additional context
Related: #26065 (struct literal comparisons through ArrayData in physical planning) and the planning-speed work in #19795.
- Ngôn ngữ chính
- Rust
- Star
- 9.5k
- Fork
- 2.5k
- Merge trung bình
- 4 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 303
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
-
[Bug] atan2 does not normalize -0.0 the way Spark doesCó thể đã có người làm @spicysharkco đã nhận 5 ngày trước. Đang mởbug spark
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/datafusion#26333 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug help wanted unparser
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/datafusion#26316 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Deduplicate bucket computation in width_bucket_interval_mdn_exactCó thể đã có người làm @Shahzeb-DataEngineer đã nhận 2 ngày trước. Đang mởenhancement good first issue help wanted spark tech debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
apache/datafusion#26307 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Use the shared aggr_test_schema in CSV scan tests instead of a local copyCó thể đã có người làm @nishant4671 đã nhận 1 ngày trước. Đang mởcore enhancement good first issue help wanted tech debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
apache/datafusion#26306 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Struct union type coercion takes field nullability from the wrong field when field order differsCó thể đã có người làm @med9110 đã nhận 6 ngày trước. Đang mởbug help wanted logical-expr tech debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/datafusion#26296 · 1 bình luận ·
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ự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
longbridge/gpui-kit#3620 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
corro-client drops the last byte of a response line that has no trailing newlineCó thể đã có người làm @RaphaelFakhri đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
proxy: include denial_category in the "proxy request denied" log lineCó thể đã có người làm @sreyas-endor đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
nolabs-ai/nono#2172 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
metasequoiaime/msime#9113 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Enhancement] Make use of available space to display more processes when maximized in Memory pageĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
pop-os/cosmic-monitor#126 ·
Maintainer thường phản hồi trong vòng 1 ngày