-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Convert BuiltInWindowFunction::{Lead, Lag}
to a user defined window function
#12857
Conversation
Fixes: doc test build errors
Thanks @alamb 🙏 |
I merged this branch up to resolve some conflicts (due to #12893) |
Sounds like a plan. I just merged #12811 -- just let me know when this PR is ready |
Marking as draft so we don't accidentally merge it before the fixes are complete |
CI tests are still failing it seems |
// See https://github.com/apache/datafusion/pull/12811 | ||
let (_expr, return_type) = rewrite_null_expr_and_data_type( | ||
partition_evaluator_args.input_exprs(), | ||
return_type, | ||
)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above bug fix in BuiltInWindowFunction:{Lead, Lag}
rewrites the NULL
expression to match the type of default value (if provided).
Right now this feature for overwriting arguments to user-defined window function is missing in WindowUDF
. So for the moment this fix cannot be applied and the newly added regression sqllogictests will fail.
I'll have to look into bridging the gap between WindowUDF
and BuiltInWindowFunction
in this case.
The bug fix relies on rewriting the NULL expression passed as argument to Right now this feature is missing in datafusion/datafusion/physical-expr/src/window/nth_value.rs Lines 115 to 117 in 16589b5
I think we need to add a similar API in For now I have disabled the new sqllogictests and marked them as TODO in 270a203. I'll do a follow on PR to add this feature and squash the bug (again). Hope that is alright? |
Yes, thank you |
Or maybe you could just make the change in this PR - the downside of merging this is that it reintroduces a bug (temporarily). I think given we are planning the 43 release #12470 in the next few days it would be nice to avoid breaking a previous bug fix |
That works. Will keep this PR as draft until the bug fix is complete. Thanks 👍 |
@alamb This is ready for review again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me -- thank you (again) @jcsherin
use datafusion_physical_expr_common::physical_expr::PhysicalExpr; | ||
use std::sync::Arc; | ||
|
||
/// Arguments passed to user-defined window function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Which issue does this PR close?
Closes #12802.
Rationale for this change
Same as #12802.
What changes are included in this PR?
lead
andlag
to user-defined window functions.Are these changes tested?
Are there any user-facing changes?
Yes.