Skip to content

[SPARK-37466][SQL] Support subexpression elimination in higher order functions #51272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Kimahriman
Copy link
Contributor

What changes were proposed in this pull request?

Adds subexpression elimination support to higher order functions. Subexpressions are calculated on lambda functions and evaluated at the start of each iteration of the loop for each function.

Why are the changes needed?

Lack of subexpression elimination inside higher order functions can lead to significant and unexpected performance issues in complex queries and ETL jobs.

Does this PR introduce any user-facing change?

No, just a performance improvement.

How was this patch tested?

New UTs

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

No

@github-actions github-actions bot added the SQL label Jun 24, 2025
@Kimahriman Kimahriman force-pushed the hof-subexpr-elimination-local branch from b36eb26 to edf2f17 Compare June 24, 2025 15:49
@Kimahriman
Copy link
Contributor Author

This builds on top of two other PRs which would be great to get some momentum on:

The changes required on top of those to actually implement the subexpression elimination in higher order functions is just in the last commit

@Kimahriman Kimahriman force-pushed the hof-subexpr-elimination-local branch from ebba29d to 02c661f Compare June 24, 2025 16:16
@Kimahriman Kimahriman force-pushed the hof-subexpr-elimination-local branch from 02c661f to 8aeb23f Compare June 24, 2025 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant