-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
How to do ignore nulls in some window functions? #2549
Comments
We don't currently have support for the SELECT id, user_id, order_id AS last_order_id
FROM table
INNER JOIN (
SELECT user_id, MAX(id) AS id
FROM table
GROUP BY 1
WHERE order_id IS NOT NULL
) filter
WHERE table.id = filter.id
AND table.user_id = filter.user_id The |
Thanks for offering the solution @hawkfish but IIUC that's not quite what I was looking for as For e.g., this is what I have
and this is what I want to get
As you can see the max order (per user) changes as we go down the table. |
Ah, sorry I get it now. You want the previous non- |
The other thing I was not catching was the fact that this was referring to the |
Add the flag to the grammar. Add user test.
Add ignore_nulls flag to BoundWindowExpression. Test unsupported cases.
Replace BitArray with ValidityMask in preparation for reusing scanning logic.
Implement for the analytic functions that Oracle supports.
The Oracle syntax also has a NOP keyword alternative to IGNORE...
Rename symbols for Windows R build.
Bump the DB version and add a round trip test for the new flag.
Resolve version conflict.
This should be fixed in #2583. |
Is it possible at the moment to ignore nulls while computing some aggregations like
first / last value
etc. in window functions like Redshift does?At present, I have
user_id, order_id
columns withorder_id
occasionally being null. I want to create a new columnlast_order_id
(per user) and is it possible to use something like this? 😃Thanks for the great work btw 🙏 😻
The text was updated successfully, but these errors were encountered: