alamb commented on code in PR #7124:
URL: https://github.com/apache/arrow-datafusion/pull/7124#discussion_r1277595058


##########
datafusion/core/tests/sqllogictests/test_files/groupby.slt:
##########
@@ -3348,3 +3348,53 @@ ORDER BY l.sn
 2 75 3
 3 200 4
 4 100 5
+
+# create a table
+statement ok
+CREATE TABLE FOO (x int) AS VALUES (1), (2);
+
+# make sure that query runs in multi partitions
+statement ok
+set datafusion.execution.target_partitions = 8;
+
+query I
+SELECT LAST_VALUE(x)
+FROM FOO;
+----
+2
+
+# plan of the query above should contain partial
+# and final aggregation stages
+query TT
+EXPLAIN SELECT LAST_VALUE(x)
+  FROM FOO;
+----
+logical_plan
+Aggregate: groupBy=[[]], aggr=[[LAST_VALUE(foo.x)]]
+--TableScan: foo projection=[x]
+physical_plan
+AggregateExec: mode=Final, gby=[], aggr=[LAST_VALUE(foo.x)]
+--CoalescePartitionsExec
+----AggregateExec: mode=Partial, gby=[], aggr=[LAST_VALUE(foo.x)]
+------MemoryExec: partitions=8, partition_sizes=[1, 0, 0, 0, 0, 0, 0, 0]
+
+query I
+SELECT FIRST_VALUE(x)

Review Comment:
   I recommend also testing `SELECT LAST_VALUE(x) GROUP BY x` (or maybe add 
another column and `GROUP BY y`) as the grouping operator is different in that 
case so the code flow might be different



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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to