avantgardnerio commented on code in PR #7192:
URL: https://github.com/apache/arrow-datafusion/pull/7192#discussion_r1298791963
##########
datafusion/sqllogictest/test_files/aggregate.slt:
##########
@@ -2291,7 +2291,54 @@ false
true
NULL
+# TopK aggregation
+statement ok
+CREATE TABLE traces(trace_id varchar, timestamp bigint) AS VALUES
+(NULL, 0),
+('a', NULL),
+('a', 1),
+('b', 0),
+('c', 1),
+('c', 2),
+('b', 3);
+
+statement ok
+set datafusion.optimizer.enable_topk_aggregation = false;
+
+query TI
+select trace_id, MAX(timestamp) from traces group by trace_id order by
MAX(timestamp) desc limit 4;
+----
+b 3
+c 2
+a 1
+NULL 0
+
+query TI
+select trace_id, MIN(timestamp) from traces group by trace_id order by
MIN(timestamp) asc limit 4;
+----
+NULL 0
+b 0
+c 1
+a 1
+
+statement ok
+set datafusion.optimizer.enable_topk_aggregation = true;
+
+query TI
+select trace_id, MAX(timestamp) from traces group by trace_id order by
MAX(timestamp) desc limit 4;
+----
+b 3
+c 2
+a 1
+NULL 0
+query TI
+select trace_id, MIN(timestamp) from traces group by trace_id order by
MIN(timestamp) asc limit 4;
Review Comment:
Thanks! I've converted them all into `sqllogictest`s and they are much less
verbose 😄 !
##########
datafusion/sqllogictest/test_files/aggregate.slt:
##########
@@ -2291,7 +2291,54 @@ false
true
NULL
+# TopK aggregation
+statement ok
+CREATE TABLE traces(trace_id varchar, timestamp bigint) AS VALUES
+(NULL, 0),
+('a', NULL),
+('a', 1),
+('b', 0),
+('c', 1),
+('c', 2),
+('b', 3);
+
+statement ok
+set datafusion.optimizer.enable_topk_aggregation = false;
+
+query TI
+select trace_id, MAX(timestamp) from traces group by trace_id order by
MAX(timestamp) desc limit 4;
+----
+b 3
+c 2
+a 1
+NULL 0
+
+query TI
+select trace_id, MIN(timestamp) from traces group by trace_id order by
MIN(timestamp) asc limit 4;
+----
+NULL 0
+b 0
+c 1
+a 1
+
+statement ok
+set datafusion.optimizer.enable_topk_aggregation = true;
+
+query TI
+select trace_id, MAX(timestamp) from traces group by trace_id order by
MAX(timestamp) desc limit 4;
+----
+b 3
+c 2
+a 1
+NULL 0
+query TI
+select trace_id, MIN(timestamp) from traces group by trace_id order by
MIN(timestamp) asc limit 4;
Review Comment:
Thanks! I've converted them all into `sqllogictest`s and they are much less
verbose 😄 !
--
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]