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

Investigate performance of CASE WHEN expression #669

Closed
andygrove opened this issue Jul 15, 2024 · 3 comments
Closed

Investigate performance of CASE WHEN expression #669

andygrove opened this issue Jul 15, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@andygrove
Copy link
Member

What is the problem the feature request solves?

Given this SQL query:

select
    sum(case when ws_wholesale_cost > 10 then 1 else 0 end) as a,
    sum(case when ws_wholesale_cost > 20 then 1 else 0 end) as b,
    sum(case when ws_wholesale_cost > 30 then 1 else 0 end) as c
from web_sales;

The query time with Comet disabled is much better than when Comet is enabled.

Disabled:

[1.5233631134033203, 0.35130977630615234, 0.3343064785003662, 0.35425901412963867, 0.31323719024658203]

Enabled:

[2.219223737716675, 0.886965274810791, 0.8125569820404053, 0.8285551071166992, 0.7927875518798828]

28 of the 99 TPC-DS queries use CASE WHEN, so optimizing this could have a nice impact on overall performance of that benchmark.

Describe the potential solution

No response

Additional context

No response

@andygrove andygrove added the enhancement New feature or request label Jul 15, 2024
@andygrove andygrove self-assigned this Jul 15, 2024
@andygrove
Copy link
Member Author

I have already started experimenting with some optimizations for this

@andygrove
Copy link
Member Author

We can specialize for certain cases, such as apache/datafusion#11484

@andygrove
Copy link
Member Author

Fixed in apache/datafusion#11484 and #672

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

No branches or pull requests

1 participant