Skip to content
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

Push scalar functions into cross join #11528

Merged
merged 3 commits into from
Jul 23, 2024

Conversation

lewiszlw
Copy link
Member

@lewiszlw lewiszlw commented Jul 18, 2024

Which issue does this PR close?

Closes #.

Rationale for this change

DataFusion CLI v37.0.0, pow function can be pushdown into cross join.
image

DataFusion CLI v40.0.0, pow function can't be pushdown into cross join.
image

I'm not sure if all UDFs should be pushdown into cross join, open for discussion.

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added the optimizer Optimizer rules label Jul 18, 2024
Copy link
Contributor

@simonvandel simonvandel left a comment

Choose a reason for hiding this comment

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

👍
I think it would be nice to add the reproducer SQL query as a slt, so this won't regress in the future.

@lewiszlw
Copy link
Member Author

lewiszlw commented Jul 18, 2024

👍 I think it would be nice to add the reproducer SQL query as a slt, so this won't regress in the future.

The previous behavior was that builtin scalar functions could be pushdown, but UDF couldn't. Now all scalar functions are converted to UDF.

@alamb alamb marked this pull request as draft July 18, 2024 20:21
@alamb
Copy link
Contributor

alamb commented Jul 18, 2024

Marking as draft as the CI is failing and looks like there is feedback to address (thanks @lewiszlw and @simonvandel !)

@lewiszlw
Copy link
Member Author

The previous behavior was that builtin scalar functions could be pushdown, but UDF couldn't. Now all scalar functions are converted to UDF.

@alamb As the behavior changed, I'd like to receive feedback first, then I'll add test and fix ci.

@alamb
Copy link
Contributor

alamb commented Jul 19, 2024

The previous behavior was that builtin scalar functions could be pushdown, but UDF couldn't. Now all scalar functions are converted to UDF.

I think we should pushdown UDF functions into cross join unless there is some reason not to.

I suspect the reason they were not being pushed down before was simply an oversight rather than a conscious decision

I agree with @simonvandel that ensuring this is covered by tests (if existing tests need to be updated that shows the change is covered).

@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Jul 22, 2024
@lewiszlw lewiszlw marked this pull request as ready for review July 22, 2024 06:50
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Makes sense to me -- thank you @lewiszlw and @simonvandel

cc @liukun4515 / @jackwener in case there is something we are missing about why we can't push filters into CROSS JOINs

@alamb alamb changed the title UDF pushdown into cross join Push scalar functions into cross join Jul 22, 2024
@alamb alamb merged commit 6d35217 into apache:main Jul 23, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants