Struct union type coercion takes field nullability from the wrong field when field order differs
Maintainer thường phản hồi trong vòng 1 ngày
@med9110 đang làm issue này rồi.
Từ ngày 14/10/2026.
Đá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
Hướng nghiên cứu
Bắt đầu từ nhánh (DataType::Struct(lhs), DataType::Struct(rhs)) nằm trong type_union_resolution_coercion ở datafusion/expr-common/src/type_coercion/binary.rs. Cho search_corresponding_coerced_type trả về thêm trường rhs có cùng tên, và truyền trường đó vào coerce_fields thay vì zip theo vị trí. Chạy các test coercion union struct hiện có trong file đó và thêm một trường hợp với thứ tự trường bị đảo. Hoàn thành khi Struct { a: Int32 NOT NULL, b: Int32 NOT NULL } union với Struct { b: Int32 NULL, a: Int32 NOT NULL } cho ra Struct { a: Int32 NOT NULL, b: Int32 NULL }.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
In the (DataType::Struct(lhs), DataType::Struct(rhs)) arm of type_union_resolution_coercion (type_coercion/binary.rs#L835-L872), each field's coerced type is computed by matching fields by name (search_corresponding_coerced_type), but the field's nullability is computed by zipping lhs and rhs positionally:
let coerced_types = lhs
.iter()
.map(|lhs_field| search_corresponding_coerced_type(lhs_field, rhs))
.collect::<Option<Vec<_>>>()?;
// preserve the field name and nullability
let orig_fields = std::iter::zip(lhs.iter(), rhs.iter());
let fields: Vec<FieldRef> = coerced_types
.into_iter()
.zip(orig_fields)
.map(|(datatype, (lhs, rhs))| coerce_fields(datatype, lhs, rhs))
.collect();
coerce_fields sets nullable = lhs.is_nullable() || rhs.is_nullable(). When the two structs have the same field names in a different order, the nullability of each output field comes from an unrelated right-hand field.
To Reproduce
Resolve the union type of:
lhs = Struct { a: Int32 NOT NULL, b: Int32 NOT NULL }rhs = Struct { b: Int32 NULL, a: Int32 NOT NULL }
The result is Struct { a: Int32 NULL, b: Int32 NOT NULL }. Field b is reported as non-nullable even though the right-hand b can contain nulls (and a is needlessly marked nullable).
Expected behavior
Nullability is taken from the name-matched pair, giving Struct { a: Int32 NOT NULL, b: Int32 NULL }. For example, have search_corresponding_coerced_type return the matched rhs_field along with the coerced type, and pass that field to coerce_fields.
Additional context
The nearby try_type_union_resolution_with_struct (about L900-L970) walks data_types three times, each re-matching DataType::Struct with an internal_err! fallback the first loop already rules out. It may be worth simplifying in the same change.
Line references are pinned to commit 0d79252f61bd.
- Ngôn ngữ chính
- Rust
- Star
- 9.4k
- Fork
- 2.5k
- Merge trung bình
- 4 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 329
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 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 @nightcityblade đã nhận 1 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 @med9110 đã 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
-
gcd benchmarks pass number_rows: 0 for 100k-row inputsCó thể đã có người làm @med9110 đã nhận 1 ngày trước. Đang mởbug functions good first issue help wanted tech debt
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
apache/datafusion#26297 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
MIN/MAX don't unwrap nested encodings inside Dictionary columnsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/datafusion#26290 ·
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ự
-
agent:triaged bug bughunt pm:bundler priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
SocketDev/socket-patch#1573 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
rustix::termios::Termios::OutputModes does not expost some const e.g. OLCUC for musl and macOSĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
bytecodealliance/rustix#1706 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 11 ngày
-
`LazyFrameRemote` and `ExecuteRemote` sinks do not accept `Path`, like `LazyFrame` sinks do.Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Bump anybuf version to ^1.0.0Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
wormhole-foundation/wormhole#5062 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
LaunchOrFocusPlugin switches to the wrong tab after tabs are reordered (tab id used as position)Có thể đã có người làm @olegator888 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
zellij-org/zellij#5719 ·
Maintainer thường phản hồi trong vòng 1 ngày