MapBuilder can't build a MapArray with sorted keys
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
- 68/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
- data-engineering
Hướng nghiên cứu
Bắt đầu từ triển khai Rust của MapBuilder: finish_helper gọi MapArray::new_unchecked với giá trị false cố định cho keys_sorted, còn make_builder bỏ qua cờ sorted trên DataType::Map. Thêm phương thức with_keys_sorted(bool) cạnh with_keys_field và with_values_field, lưu cờ này và truyền nó vào finish_helper. Hoàn thành khi ví dụ StructBuilder trong issue được xây dựng mà không panic và một bài kiểm thử xác nhận MapArray thu được báo keys_sorted là true.
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? Please describe what you are trying to do.
MapBuilder always builds maps with keys_sorted = false. finish_helper passes false to MapArray::new_unchecked and there's no way to change it. make_builder also ignores the flag on DataType::Map(field, sorted).
So a builder made from a schema that has a sorted map field produces a column that doesn't match its own field. Inside a struct it panics:
let fields = vec![Field::new_map(
"m",
"entries",
Field::new("keys", DataType::Utf8, false),
Field::new("values", DataType::Int32, true),
true, // keys_sorted
false,
)];
let mut builder = StructBuilder::from_fields(fields, 1);
builder
.field_builder::<MapBuilder<Box<dyn ArrayBuilder>, Box<dyn ArrayBuilder>>>(0)
.unwrap()
.append(true)
.unwrap();
builder.append(true);
builder.finish();
// panics: Incorrect datatype for StructArray field "m", expected a sorted Map, got an unsorted one
The only workaround today is to finish the map, take it apart with into_parts() and rebuild it with MapArray::new(.., true). That doesn't help when the map is a child of a StructBuilder or ListBuilder, because the parent calls ArrayBuilder::finish on the child itself. Downstream crates end up wrapping MapBuilder just to set the flag.
Describe the solution you'd like
- Add
MapBuilder::with_keys_sorted(bool), next towith_keys_fieldandwith_values_field, defaulting tofalse. - Have
make_builderpass the flag fromDataType::Map.
The builder would only set the flag and not check key order, same as MapArray::try_new.
Describe alternatives you've considered
Validating the order in finish when the flag is set. That would need a comparison over arbitrary key types and would make finish fallible or panicking for something MapArray::try_new doesn't check either, so I'd leave it out.
Additional context
Related: #7100 / #7101 (with_keys_field), #11603 (FFI export dropped the keys sorted flag). I have a branch with the change and tests and can open a PR.
- Ngôn ngữ chính
- Rust
- Star
- 3.7k
- Fork
- 1.5k
- Merge trung bình
- 2 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 183
Chuẩn bị môi trường
- 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/arrow-rs
-
parquet: `ArrowWriter::try_new` panics on a schema with a Union field instead of returning an errorĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
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 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`RunArray::try_new` rejects run ends whose null buffer has no nullsCó thể đã có người làm @Surajsuthar đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
apache/arrow-rs#12427 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Variant] `variant_get` string and binary cast errors show Rust builder type namesCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
Maintainer thường phản hồi trong vòng 1 ngày
-
parquet: GZip/Brotli page decompression is not bounded by the page's uncompressed sizeCó thể đã có người làm @Subodh-17 đã nhận 11 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
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/arrow-rs
Issue tương tự
-
area:ui effort:medium enhancement P7 source:agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
marketing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
machine rename accepts a label already used by another machine, making --machine <label> ambiguousĐang mởmaintainer-needed p2 remote triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug help wanted ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
userFRM/egui-charts#4605 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày