Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PartiQL Shape union doesn't unify #486

Open
jpschorr opened this issue Aug 14, 2024 · 0 comments
Open

PartiQL Shape union doesn't unify #486

jpschorr opened this issue Aug 14, 2024 · 0 comments

Comments

@jpschorr
Copy link
Contributor

jpschorr commented Aug 14, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant