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

Make NOT EXISTS (subquery) and NOT IN (subquery) more consistent in the AST #472

Closed
andygrove opened this issue Apr 26, 2022 · 5 comments · Fixed by #523
Closed

Make NOT EXISTS (subquery) and NOT IN (subquery) more consistent in the AST #472

andygrove opened this issue Apr 26, 2022 · 5 comments · Fixed by #523

Comments

@andygrove
Copy link
Collaborator

The AST has one variant to support both IN (subquery) and NOT IN (subquery):

InSubquery {
    expr: Box<Expr>,
    subquery: Box<Query>,
    negated: bool,
},

However, the variant for EXISTS does not handle NOT EXISTS:

Exists(Box<Query>)

NOT EXISTS is represented in the AST by wrapping Exists in a UnaryOp with UnaryOperator::Not.

It would be nice if we could use a more consistent approach.

@alamb
Copy link
Collaborator

alamb commented Apr 26, 2022

I would prefer to see

Exists {
      expr: Box<Expr>,
      subquery: Box<Query>,
}

@frolovdev
Copy link
Contributor

I guess I can help 🚀

@frolovdev
Copy link
Contributor

frolovdev commented Jun 13, 2022

@alamb but what do you mean by expr in Exists, because your comment isn't clear for me right now

Maybe you mean smth like that

Exists {
      negated: bool,
      subquery: Box<Query>,
}

because we don't have any Expr::identifier in EXISTS and NOT EXISTS

@alamb
Copy link
Collaborator

alamb commented Jun 13, 2022

Maybe you mean smth like that

Yes, that is what I mean -- thank you @frolovdev

@frolovdev
Copy link
Contributor

frolovdev commented Jun 13, 2022

Yes, that is what I mean -- thank you @frolovdev

Got your point, thanks for the clarification, here's the pr :d

#523

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

Successfully merging a pull request may close this issue.

3 participants