Struct union type coercion takes field nullability from the wrong field when field order differs
Les mainteneurs répondent en général sous 1 jour
@med9110 y travaille déjà.
Depuis le 14/10/2026.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 68/100
Piste de recherche
Commence dans la branche (DataType::Struct(lhs), DataType::Struct(rhs)) de type_union_resolution_coercion, dans datafusion/expr-common/src/type_coercion/binary.rs. Fais en sorte que search_corresponding_coerced_type retourne aussi le champ rhs de même nom et passe ce champ à coerce_fields au lieu du zip positionnel. Exécute les tests existants de coercition d'union de struct dans ce fichier et ajoute un cas avec les champs dans l'ordre inverse. C'est terminé lorsque Struct { a: Int32 NOT NULL, b: Int32 NOT NULL } unifié avec Struct { b: Int32 NULL, a: Int32 NOT NULL } donne Struct { a: Int32 NOT NULL, b: Int32 NULL }.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Rust
- Étoiles
- 9.4k
- Forks
- 2.5k
- Merge moyen
- 4 j 9 h
- PR mergées (30 j)
- 329
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/datafusion
-
bug help wanted unparser
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
apache/datafusion#26316 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Deduplicate bucket computation in width_bucket_interval_mdn_exactPeut-être pris @nightcityblade l’a pris il y a 1 jour. Ouverteenhancement good first issue help wanted spark tech debt
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
apache/datafusion#26307 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Use the shared aggr_test_schema in CSV scan tests instead of a local copyPeut-être pris @med9110 l’a pris il y a 1 jour. Ouvertecore enhancement good first issue help wanted tech debt
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
apache/datafusion#26306 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
gcd benchmarks pass number_rows: 0 for 100k-row inputsPeut-être pris @med9110 l’a pris il y a 1 jour. Ouvertebug functions good first issue help wanted tech debt
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
apache/datafusion#26297 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
MIN/MAX don't unwrap nested encodings inside Dictionary columnsPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
apache/datafusion#26290 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de apache/datafusion
Issues similaires
-
agent:triaged bug bughunt pm:bundler priority:p1
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
SocketDev/socket-patch#1573 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
rustix::termios::Termios::OutputModes does not expost some const e.g. OLCUC for musl and macOSOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
bytecodealliance/rustix#1706 · 1 commentaire ·
Les mainteneurs répondent en général sous 11 jours
-
`LazyFrameRemote` and `ExecuteRemote` sinks do not accept `Path`, like `LazyFrame` sinks do.Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
-
Bump anybuf version to ^1.0.0Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
wormhole-foundation/wormhole#5062 ·
Les mainteneurs répondent en général sous 1 jour
-
LaunchOrFocusPlugin switches to the wrong tab after tabs are reordered (tab id used as position)Peut-être pris @olegator888 l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
zellij-org/zellij#5719 ·
Les mainteneurs répondent en général sous 1 jour