Skip to content

sql: detect source predicates in WHERE clauses #10632

@knz

Description

@knz

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.

Metadata

Metadata

Assignees

Labels

A-sql-pgcompatSemantic compatibility with PostgreSQL

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions