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

sql: detect source predicates in WHERE clauses #10632

Closed
knz opened this issue Nov 11, 2016 · 0 comments
Closed

sql: detect source predicates in WHERE clauses #10632

knz opened this issue Nov 11, 2016 · 0 comments
Assignees
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL

Comments

@knz
Copy link
Contributor

knz commented Nov 11, 2016

After the WHERE condition is normalized to disjunctive normal form, extract all the conjunctions that test for equality between simple column references to the input data sources, then propagate these predicates "down" the data source.

This must introduce a new interface pushPredicateDown on a data source, which will transform the data source accordingly:

  • pushPredicateDown on a scanNode does the job currently performed by selectNode already
  • pushPredicateDown on a joinNode must check:
    • for every equality pertaining to columns on both sides of the join, extend the existing predicate accordingly, possibly using equalityPredicate after sql: introduce a new predicate structure to replace usingPredicate #10630 is addressed.
    • for every remaining equality (pertaining only to columns on one side), push the predicate down further to the join source operand
  • for selectNode, do sql: translate predicates coming from an outer context in selectNode #11723
  • for every case where it makes sense, call pushPredicateDown recursively.
  • in every remaining case, pushPredicateDown can insert an new intermediate selectNode that just does that filtering, keeping the original source as its source.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL
Projects
None yet
Development

No branches or pull requests

3 participants