You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
(This section helps Arrow developers understand the context and why for this feature, in addition to the what)
A new challenge, to support aggregate function with filter. See Postgres manual
Describe the solution you'd like
A clear and concise description of what you want to happen.
@jimexist if you are proposing supporting this kind of syntax, then I think it is a reasonable idea.
SELECT
count(*) AS unfiltered,
count(*) FILTER (WHERE i < 5) AS filtered
FROM generate_series(1,10) AS s(i);
unfiltered | filtered
------------+----------
10 | 4
(1 row)
For anyone else who might read this ticket, You can express the same type of query using SQL that data fusion already supports via CASE, though it is much less beautiful. Something like:
@alamb yes, that's a great one - isn't that only feasible with SUM/MAX/MIN? I think primary use case would be COUNT or AVG
Edit: yeah or simulating count using SUM, as I am seeing in your example. You could do something in the same way for AVG of course if you are feeling creative :D
Activity
Dandandan commentedon May 5, 2021
That would be a valuable feature @jimexist
alamb commentedon May 6, 2021
@jimexist if you are proposing supporting this kind of syntax, then I think it is a reasonable idea.
For anyone else who might read this ticket, You can express the same type of query using SQL that data fusion already supports via CASE, though it is much less beautiful. Something like:
$ seq 1 10 > /tmp/foo.csv $ cargo run -p datafusion-cliDandandan commentedon May 6, 2021
@alamb yes, that's a great one - isn't that only feasible with
SUM/MAX/MIN? I think primary use case would beCOUNTorAVGEdit: yeah or simulating count using
SUM, as I am seeing in your example. You could do something in the same way forAVGof course if you are feeling creative :Dkawadakk commentedon May 30, 2024
This feature has been implemented by #5868. Note that (afaik) you still need to select a SQL dialect supporting it.
jayzhan211 commentedon May 30, 2024
It seems we can close this issue
doc: Fix a small typo in README.md (apache#272)