-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Add SUM(BOOL) overload #15042
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
Add SUM(BOOL) overload #15042
Conversation
|
I guess this becomes equivalent to: but nice to provide the overload. |
|
No, |
|
Thanks, again |
|
Isn't SELECT count() FILTER (l_extendedprice > 500) FROM lineitem;the canonical way of doing this? It's also faster than the |
|
That's another alternative yeah, but FILTER is supported in much fewer systems. It is around as fast as the |
|
By the way, the macro |
|
Opened a PR for that here - #15061 |
Add SUM(BOOL) overload (duckdb/duckdb#15042)
Add SUM(BOOL) overload (duckdb/duckdb#15042)
Add SUM(BOOL) overload (duckdb/duckdb#15042) Co-authored-by: krlmlr <krlmlr@users.noreply.github.com>
This is a useful overload that allows the user to quickly count the amount of matches for a boolean condition, it is essentially syntactic sugar for:
As an added bonus, it is also slightly faster than the above expression: