Skip to content

feat(AQE): empty join handling#1723

Open
sandugood wants to merge 6 commits into
apache:mainfrom
sandugood:feat/empty-join-elimination
Open

feat(AQE): empty join handling#1723
sandugood wants to merge 6 commits into
apache:mainfrom
sandugood:feat/empty-join-elimination

Conversation

@sandugood
Copy link
Copy Markdown
Contributor

@sandugood sandugood commented May 18, 2026

Which issue does this PR close?

Handles #1359, particularly this part:

verify if we can reuse instead of creating our own rule for eliminating joins

Rationale for this change

Handling cases of different physical types of joins and adding branching for different logical parts (i.e Left or LeftAnti) without adding separate AQE rule - adding logic straight into the PropagateEmptyExecRule

What changes are included in this PR?

  1. Added JoinInfo struct to contain information about the join (both left and right part)
  2. Added as_join function, which can be extended in the future to add support for other physical joins. Right now it handles both SortMerge and HashJoin
  3. Reused is_guaranteed_empty from the Spice-AI implementation of eliminating empty joins.

Are there any user-facing changes?

No

Were this changes tested?

Yes, tests were included in both propagate_empty.rs and join_info.rs

@sandugood sandugood changed the title feat(AQE): added empty join handling feat(AQE): empty join handling May 20, 2026
@milenkovicm
Copy link
Copy Markdown
Contributor

thanks @sandugood will have a look soon

Copy link
Copy Markdown
Contributor

@milenkovicm milenkovicm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for late review @sandugood
few recommendations

this is extra on top of your current contribution that would make sense to be added, please add it.

empty_exec! should produce correct partition num

macro_rules! empty_exec {
    ($e:expr) => {
        Ok(Transformed::yes(Arc::new(
            EmptyExec::new($e.schema())
                .with_partitions($e.properties().output_partitioning().partition_count()),
        )))
    };
}

add configuration value

ballista.planner.propagate_empty.enabled=true as we may need to disable this rule in some cases

Comment thread ballista/scheduler/src/state/aqe/optimizer_rule/join_info.rs Outdated
@milenkovicm
Copy link
Copy Markdown
Contributor

#1752 has few other rules added, could you please copy paste them here. Will merge this pr before that one and makes sense to include them

@sandugood
Copy link
Copy Markdown
Contributor Author

Seems like there is an error when trying to get packages from crates.io
Could you, please, rerun the CI in a while?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants