You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/06/23 08:47:22 UTC

[GitHub] [arrow-datafusion] Jimexist opened a new pull request #607: fix 592, support alias in window functions

Jimexist opened a new pull request #607:
URL: https://github.com/apache/arrow-datafusion/pull/607


   # Which issue does this PR close?
   
   Closes #592 
   
    # Rationale for this change
   
   turns out there's no need to rebase any `expr`s, removing the rebase would resolve the issue
   
   # What changes are included in this PR?
   <!--
   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 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] houqp commented on a change in pull request #607: fix 592, support alias in window functions

Posted by GitBox <gi...@apache.org>.
houqp commented on a change in pull request #607:
URL: https://github.com/apache/arrow-datafusion/pull/607#discussion_r657577330



##########
File path: datafusion/src/sql/planner.rs
##########
@@ -2826,6 +2818,16 @@ mod tests {
         quick_test(sql, expected);
     }
 
+    #[test]
+    fn empty_over_dup_with_alias() {
+        let sql = "SELECT order_id oid, MAX(order_id) OVER () max_oid, MAX(order_id) OVER () max_oid_dup from orders";
+        let expected = "\
+        Projection: #orders.order_id AS oid, #MAX(orders.order_id) AS max_oid, #MAX(orders.order_id) AS max_oid_dup\
+        \n  WindowAggr: windowExpr=[[MAX(#orders.order_id)]]\

Review comment:
       not only the planner, the builder also does this for those who use the dataframe apis directly ;)




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb merged pull request #607: fix 592, support alias in window functions

Posted by GitBox <gi...@apache.org>.
alamb merged pull request #607:
URL: https://github.com/apache/arrow-datafusion/pull/607


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb commented on a change in pull request #607: fix 592, support alias in window functions

Posted by GitBox <gi...@apache.org>.
alamb commented on a change in pull request #607:
URL: https://github.com/apache/arrow-datafusion/pull/607#discussion_r657109398



##########
File path: datafusion/src/sql/planner.rs
##########
@@ -2826,6 +2818,16 @@ mod tests {
         quick_test(sql, expected);
     }
 
+    #[test]
+    fn empty_over_dup_with_alias() {
+        let sql = "SELECT order_id oid, MAX(order_id) OVER () max_oid, MAX(order_id) OVER () max_oid_dup from orders";
+        let expected = "\
+        Projection: #orders.order_id AS oid, #MAX(orders.order_id) AS max_oid, #MAX(orders.order_id) AS max_oid_dup\
+        \n  WindowAggr: windowExpr=[[MAX(#orders.order_id)]]\

Review comment:
       this is pretty cool that the planner has identified the redundancy and only computes `MAX` once 👍 




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb commented on pull request #607: fix 592, support alias in window functions

Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #607:
URL: https://github.com/apache/arrow-datafusion/pull/607#issuecomment-867704472


   Thanks @Jimexist 


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org