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

Optimize CASE WHEN for "expression or null" case #11484

Closed
andygrove opened this issue Jul 15, 2024 · 1 comment · Fixed by #11534
Closed

Optimize CASE WHEN for "expression or null" case #11484

andygrove opened this issue Jul 15, 2024 · 1 comment · Fixed by #11534
Assignees
Labels
enhancement New feature or request

Comments

@andygrove
Copy link
Member

Is your feature request related to a problem or challenge?

Given the expression CASE WHEN predicate THEN expr ELSE null END (as seen in some TPC-DS queries) we could do better than using our generic CaseExpr. In this specific case we can evaluate expr and create a new array using the existing data buffer but just replace the null mask with the results of evaluating the predicate.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

@andygrove
Copy link
Member Author

I am implementing this in Comet in apache/datafusion-comet#672 and plan on upstreaming to DataFusion soon. The optimization is resulting in a > 10x speedup for my test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant