apache / apache/datafusion

Move WHERE expression to join conversion to optimization rule

Open
#3,840 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
During optimization, we generate `filter` expressions that might benefit from being optimized to joins.

Currently, where filters like these `where left_column = right_column` are converted to joins in the SQL planner (in the function `plan_selection`).
We should have a rule that does the same thing and let it replace the conversion in the planner.

**Describe the solution you'd like**
Implement the where expression to join conversion in an optimization rule instead, so it can also be used after filters have been added to the plan and try to convert them to joins as well.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the SQL planner's plan_selection function, where WHERE filters are currently converted to joins. Identify the existing conversion logic and the optimization-rule interfaces around it. Done means the conversion is performed by an optimization rule, replaces the planner conversion, and also handles filters added later in planning.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.