Skip to content

Comments

[SPARK-45369][SQL] Push down limit through generate#43167

Closed
wangyum wants to merge 2 commits intoapache:masterfrom
wangyum:SPARK-45369
Closed

[SPARK-45369][SQL] Push down limit through generate#43167
wangyum wants to merge 2 commits intoapache:masterfrom
wangyum:SPARK-45369

Conversation

@wangyum
Copy link
Member

@wangyum wangyum commented Sep 28, 2023

What changes were proposed in this pull request?

This PR enhances LimitPushDown to push down limit through Generate if it's outer is true. For example:

SELECT *
FROM   (
    SELECT    *
    FROM      t1
    LEFT JOIN t2 ON t1.id = t2.id) t
LATERAL VIEW explode_outer(t.category) AS e
LIMIT 30

Why are the changes needed?

Improve query performance. Especially push down limit through generate and join.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Unit test and benchmark test.

Before this PR After this PR
image image

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the SQL label Sep 28, 2023
@wangyum
Copy link
Member Author

wangyum commented Sep 28, 2023

cc @cloud-fan

Copy link
Contributor

@beliefer beliefer left a comment

Choose a reason for hiding this comment

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

It seems that we can continue push down the Limit beneath the Join.


/**
* Pushes down [[LocalLimit]] beneath UNION ALL, OFFSET and joins.
* Pushes down [[LocalLimit]] beneath UNION ALL, OFFSET, joins, Generate and Python UDFs.
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch!

@github-actions
Copy link

We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!

@github-actions github-actions bot added the Stale label Jan 16, 2024
@github-actions github-actions bot closed this Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants