After #485 PartiqlShapeBuilder.any_of:
pub fn any_of<I>(&self, types: I) -> PartiqlShape
where
I: IntoIterator<Item = PartiqlShape>,
{
let any_of = AnyOf::from_iter(types);
match any_of.types.len() {
0 => type_dynamic!(),
1 => {
let AnyOf { types } = any_of;
types.into_iter().next().unwrap()
}
// TODO figure out what does it mean for a Union to be nullable or not
_ => PartiqlShape::AnyOf(any_of),
}
}
The AnyOf::from_iter(types) uses an IndexSet internally to deduplicate types, thus the match on any_of.types.len() could "flatten" AnyOfs that had duplicates. With the addition of IDs, this deduplication no longer happens...
Originally posted by @jpschorr in #485 (review)
After #485
PartiqlShapeBuilder.any_of:The
AnyOf::from_iter(types)uses anIndexSetinternally to deduplicate types, thus the match onany_of.types.len()could "flatten"AnyOfs that had duplicates. With the addition of IDs, this deduplication no longer happens...Originally posted by @jpschorr in #485 (review)