intersect_metadata_for_union

Function intersect_metadata_for_union 

Source
pub fn intersect_metadata_for_union<'a>(
    metadatas: impl IntoIterator<Item = &'a HashMap<String, String>>,
) -> HashMap<String, String>
Expand description

Intersects multiple metadata instances for UNION operations.

This function implements the intersection strategy used by UNION operations, where only metadata keys that exist in ALL inputs with identical values are preserved in the result.

§Union Metadata Behavior

Union operations require consistent metadata across all branches:

  • Only metadata keys present in ALL union branches are kept
  • For each kept key, the value must be identical across all branches
  • If a key has different values across branches, it is excluded from the result
  • If any input has no metadata, the result will be empty

§Arguments

  • metadatas - An iterator of SchemaFieldMetadata instances to intersect

§Returns

A new SchemaFieldMetadata containing only the intersected metadata