You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mustafasrepo (via GitHub)" <gi...@apache.org> on 2023/04/10 07:01:51 UTC
[GitHub] [arrow-datafusion] mustafasrepo opened a new pull request, #5938: Add window reversal sub rule to pipeline fixer.
mustafasrepo opened a new pull request, #5938:
URL: https://github.com/apache/arrow-datafusion/pull/5938
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #.
# Rationale for this change
If window expression is in the form
`SUM(inc_col) OVER(ORDER BY ts DESC ROWS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING) as sum1` it should be calculated with `WindowAggExec`. However, it can be converted to the equivalent form
`SUM(inc_col) OVER(ORDER BY ts ASC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING) as sum1`
Second form can be calculated with `BoundedWindowAggExec` without breaking the pipeline (given that its input is already ordered with `ts ASC`).
If source is unbounded, we should convert expression in the form 1 to in the form 2 not break pipeline.
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
# What changes are included in this PR?
This PR adds a subrule for above check. If source is unbounded, variants in the form is converted to form 2 to not break pipeline.
Util codes to construct test table are moved from `window.rs` to under `test_util/mod.rs` to be able to use utils in other files.
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
# Are these changes tested?
Yes `test_source_sorted_unbounded_source` is added to check this behaviour.
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] ozankabak commented on a diff in pull request #5938: Move error check from pipeline fixer to pipeline checker
Posted by "ozankabak (via GitHub)" <gi...@apache.org>.
ozankabak commented on code in PR #5938:
URL: https://github.com/apache/arrow-datafusion/pull/5938#discussion_r1161899802
##########
datafusion/core/src/physical_optimizer/pipeline_checker.rs:
##########
@@ -314,7 +314,7 @@ mod sql_tests {
FROM test
LIMIT 5".to_string(),
cases: vec![Arc::new(test1), Arc::new(test2)],
- error_operator: "Window Error".to_string()
+ error_operator: "Sort Error".to_string()
Review Comment:
I think this happens because when the task of erroring out is left to `PipelineChecker`, which is the last rule, sorts are already in-place. While checking, the algorithm first encounters the sort (before the window), which is is pipeline-breaking. Hence the error messsage.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb merged pull request #5938: Move error check from pipeline fixer to pipeline checker
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #5938:
URL: https://github.com/apache/arrow-datafusion/pull/5938
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #5938: Move error check from pipeline fixer to pipeline checker
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #5938:
URL: https://github.com/apache/arrow-datafusion/pull/5938#issuecomment-1504043697
Thank you @mustafasrepo @ozankabak and @comphead for the review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] comphead commented on a diff in pull request #5938: Move error check from pipeline fixer to pipeline checker
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #5938:
URL: https://github.com/apache/arrow-datafusion/pull/5938#discussion_r1161878997
##########
datafusion/core/src/physical_optimizer/pipeline_checker.rs:
##########
@@ -314,7 +314,7 @@ mod sql_tests {
FROM test
LIMIT 5".to_string(),
cases: vec![Arc::new(test1), Arc::new(test2)],
- error_operator: "Window Error".to_string()
+ error_operator: "Sort Error".to_string()
Review Comment:
lgtm, thanks for taking this, why the error message changed to Sort Error, I dont see the respective logic change..
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org