fix: default UDWFImpl::expressions returns all expressions#13169
fix: default UDWFImpl::expressions returns all expressions#13169alamb merged 5 commits intoapache:mainfrom
Conversation
timsaucer
left a comment
There was a problem hiding this comment.
Thank you! I tested this same code on datafusion-python. We do have a unit test there that caught the issue. I wonder if we should add one here. Not a blocking suggestion, because I do think this is a regression.
Thank you @Michael-J-Ward and @timsaucer The reason we introduced a regression is likely due to the lack of a test and thus I think a test with the fix would be super helpful. Any thoughts about how to trigger it ? I can potentially help write such a test |
I'll write it up. |
|
This is a possible way to unit test the default implementation of But putting this in test |
|
Thank you for writing that up! I added it, verified it fails without @Michael-J-Ward 's fix and passes with the correction. @Michael-J-Ward do you mind if I push it to your branch? |
|
Since the testing approach made sense, I rewrote it to be a bit more exhaustive than the initial iteration. I added more test cases to cover when 0, 1, 2 and 3 input expressions are provided. Earlier version only checks for exactly 3 arguments and I think that is insufficient testing to avoid any regressions in the future. It passes in The same limitation as earlier applies. It is not possible to place this unit test in I think we can add this to the @timsaucer Please feel free to make any improvements you feel would be beneficial. Code: |
We can always put the tests in https://github.com/apache/datafusion/blob/main/datafusion/core/tests/core_integration.rs which has access to all the functionality |
|
Thank you @jcsherin . I appreciate you taking point on writing up the unit test. I've tested and pushed it. Does anyone else want to review? |
alamb
left a comment
There was a problem hiding this comment.
Looks awesome -- thank you everyone 🙏
Which issue does this PR close?
Closes #13168.
Rationale for this change
Same as in #13168.
What changes are included in this PR?
WindowUDFImpl::expressionsis changed to return all the input expressions by default instead of only the 1st one.Are these changes tested?
Covered by existing tests.
Are there any user-facing changes?
Not from a released version.