MCPcopy Create free account
hub / github.com/apache/datafusion / has_one_of_more_common_fields

Function has_one_of_more_common_fields

datafusion/common/src/nested_struct.rs:492–503  ·  view source on GitHub ↗

Check if two field lists have at least one common field by name. This is useful for validating struct compatibility when casting between structs, ensuring that source and target fields have overlapping names.

(
    source_fields: &[FieldRef],
    target_fields: &[FieldRef],
)

Source from the content-addressed store, hash-verified

490/// This is useful for validating struct compatibility when casting between structs,
491/// ensuring that source and target fields have overlapping names.
492pub fn has_one_of_more_common_fields(
493 source_fields: &[FieldRef],
494 target_fields: &[FieldRef],
495) -> bool {
496 let source_names: HashSet<&str> = source_fields
497 .iter()
498 .map(|field| field.name().as_str())
499 .collect();
500 target_fields
501 .iter()
502 .any(|field| source_names.contains(field.name().as_str()))
503}
504
505#[cfg(test)]
506mod tests {

Callers 2

can_evaluateMethod · 0.85

Calls 7

collectMethod · 0.80
mapMethod · 0.45
iterMethod · 0.45
as_strMethod · 0.45
nameMethod · 0.45
anyMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…