Skip to content

EliminateOuterJoin should descend through Projection #22531

@neilconway

Description

@neilconway

Is your feature request related to a problem or challenge?

Currently, the EliminateOuterJoin rewrite looks for a Filter node directly above a Join node. For most queries, that is the right plan shape to look for (because PushdownFilter will typically place the filters that are useful for outer join elimination directly on top of the relevant Join node). However, some plans don't follow this shape, for at least two reasons:

  1. Filters on volatile expressions result in a Projection node between the Filter and the Join
  2. OptimizeProjections might result in placing a Projection node between the Filter and the Join

Notably, we run into case (2) in TPC-DS Q49; we currently fail to convert three outer joins to inner joins for that reason.

In both cases, we can teach EliminateOuterJoin to look for the Filter -> Projection -> Join plan shape as well.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions