Skip to content

Apache DataFusion SQL Query Engine

Add slt test for `DISTINCT ON` with wildcard (#12968)

Andrew Lamb6d5ecb62b993
diff --git a/datafusion/sqllogictest/test_files/distinct_on.slt b/datafusion/sqllogictest/test_files/distinct_on.slt
index 99639d78c3..604ac95ff4 100644
--- a/datafusion/sqllogictest/test_files/distinct_on.slt
+++ b/datafusion/sqllogictest/test_files/distinct_on.slt
@@ -144,6 +144,19 @@ LIMIT 3;
45 15673
-72 -11122
+# use wildcard
+query TIIIIIIIITRRT
+SELECT DISTINCT ON (c1) * FROM aggregate_test_100 ORDER BY c1 LIMIT 3;
+----
+a 1 -85 -15154 1171968280 1919439543497968449 77 52286 774637006 12101411955859039553 0.12285209 0.686439196277 0keZ5G8BffGwgF2RwQD59TFzMStxCB
+b 1 29 -18218 994303988 5983957848665088916 204 9489 3275293996 14857091259186476033 0.53840446 0.179090351188 AyYVExXK6AR2qUTxNZ7qRHQOVGMLcz
+c 2 1 18109 2033001162 -6513304855495910254 25 43062 1491205016 5863949479783605708 0.110830784 0.929409733247 6WfVFBVGJSQb7FhA7E0lBwdvjfZnSW
+
+# can't distinct on *
+query error DataFusion error: SQL error: ParserError\("Expected: an expression:, found: \*"\)
+SELECT DISTINCT ON (*) c1 FROM aggregate_test_100 ORDER BY c1 LIMIT 3;
+
+
# test distinct on
statement ok
create table t(a int, b int, c int) as values (1, 2, 3);