Dandandan commented on a change in pull request #558:
URL: https://github.com/apache/arrow-datafusion/pull/558#discussion_r654776385



##########
File path: datafusion/src/execution/context.rs
##########
@@ -1355,6 +1355,90 @@ mod tests {
         Ok(())
     }
 
+    #[tokio::test]
+    async fn window_partition_by() -> Result<()> {
+        let results = execute(
+            "SELECT \
+            c1, \
+            c2, \
+            SUM(c2) OVER (PARTITION BY c2), \
+            COUNT(c2) OVER (PARTITION BY c2), \
+            MAX(c2) OVER (PARTITION BY c2), \
+            MIN(c2) OVER (PARTITION BY c2), \
+            AVG(c2) OVER (PARTITION BY c2) \
+            FROM test \
+            ORDER BY c1, c2 \
+            LIMIT 5",
+            4,
+        )
+        .await?;
+        dbg!(results.len());
+        // result in one batch, although e.g. having 2 batches do not change
+        // result semantics, having a len=1 assertion upfront keeps surprises
+        // at bay
+        assert_eq!(results.len(), 1);

Review comment:
       I think this shouldn't be tested (with the same reasoning of the 
comment).
   
   For example, if we would split the data in different partitions based on 
hashing the partition by expression, we are going to emit multiple batches.




-- 
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:
[email protected]


Reply via email to