Skip to content

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

Closed

Description

@andygrove

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.

Activity

  1. alamb commented on Apr 26, 2022

    @alamb
    Contributor

    I would prefer to see

    Exists {
          expr: Box<Expr>,
          subquery: Box<Query>,
    }
  2. frolovdev commented on Jun 13, 2022

    @frolovdev
    Contributor

    I guess I can help 🚀

  3. frolovdev commented on Jun 13, 2022

    @frolovdev
    Contributor

    @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

  4. alamb commented on Jun 13, 2022

    @alamb
    Contributor

    Maybe you mean smth like that

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

  5. frolovdev commented on Jun 13, 2022

    @frolovdev
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions