You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Improve groupby error message for new version of expand wildcard logic, also modified related CICL content
* Improved error message for new expand wildcard logic, also editted related CICL test
* improved syntax requested by CICL process
* unified and , updated test error message
"{}: Expression {} could not be resolved from available columns: {}",
162
+
"{}: While expanding wildcard, column \"{}\" must appear in the GROUP BY clause or must be part of an aggregate function, currently only \"{}\" appears in the SELECT clause satisfies this requirement",
let err = logical_plan(sql).expect_err("query should have failed");
822
822
assert_eq!(
823
-
"Error during planning: HAVING clause references non-aggregate values: Expression person.first_name could not be resolved from available columns: person.id, max(person.age)",
823
+
"Error during planning: Column in HAVING must be in GROUP BY or an aggregate function: While expanding wildcard, column \"person.first_name\" must appear in the GROUP BY clause or must be part of an aggregate function, currently only \"person.id, max(person.age)\" appears in the SELECT clause satisfies this requirement",
let err = logical_plan(sql).expect_err("query should have failed");
846
846
assert_eq!(
847
-
"Error during planning: Projection references non-aggregate values: Expression person.first_name could not be resolved from available columns: max(person.age)",
847
+
"Error during planning: Column in SELECT must be in GROUP BY or an aggregate function: While expanding wildcard, column \"person.first_name\" must appear in the GROUP BY clause or must be part of an aggregate function, currently only \"max(person.age)\" appears in the SELECT clause satisfies this requirement",
let err = logical_plan(sql).expect_err("query should have failed");
882
882
assert_eq!(
883
-
"Error during planning: HAVING clause references non-aggregate values: Expression person.first_name could not be resolved from available columns: count(*)",
883
+
"Error during planning: Column in HAVING must be in GROUP BY or an aggregate function: While expanding wildcard, column \"person.first_name\" must appear in the GROUP BY clause or must be part of an aggregate function, currently only \"count(*)\" appears in the SELECT clause satisfies this requirement",
let err = logical_plan(sql).expect_err("query should have failed");
1003
1003
assert_eq!(
1004
-
"Error during planning: HAVING clause references non-aggregate values: Expression person.last_name could not be resolved from available columns: person.first_name, max(person.age)",
1004
+
"Error during planning: Column in HAVING must be in GROUP BY or an aggregate function: While expanding wildcard, column \"person.last_name\" must appear in the GROUP BY clause or must be part of an aggregate function, currently only \"person.first_name, max(person.age)\" appears in the SELECT clause satisfies this requirement",
let sql = "SELECT ((age + 1) / 2) * (age + 9), MIN(first_name) FROM person GROUP BY age + 1";
1366
1366
let err = logical_plan(sql).expect_err("query should have failed");
1367
1367
assert_eq!(
1368
-
"Error during planning: Projection references non-aggregate values: Expression person.age could not be resolved from available columns: person.age + Int64(1), min(person.first_name)",
1368
+
"Error during planning: Column in SELECT must be in GROUP BY or an aggregate function: While expanding wildcard, column \"person.age\" must appear in the GROUP BY clause or must be part of an aggregate function, currently only \"person.age + Int64(1), min(person.first_name)\" appears in the SELECT clause satisfies this requirement",
let sql = "SELECT age, MIN(first_name) FROM person GROUP BY age + 1";
1376
1376
let err = logical_plan(sql).expect_err("query should have failed");
1377
1377
assert_eq!(
1378
-
"Error during planning: Projection references non-aggregate values: Expression person.age could not be resolved from available columns: person.age + Int64(1), min(person.first_name)",
1378
+
"Error during planning: Column in SELECT must be in GROUP BY or an aggregate function: While expanding wildcard, column \"person.age\" must appear in the GROUP BY clause or must be part of an aggregate function, currently only \"person.age + Int64(1), min(person.first_name)\" appears in the SELECT clause satisfies this requirement",
1379
1379
err.strip_backtrace()
1380
1380
);
1381
1381
}
@@ -1636,7 +1636,7 @@ fn select_7480_2() {
1636
1636
let sql = "SELECT c1, c13, MIN(c12) FROM aggregate_test_100 GROUP BY c1";
1637
1637
let err = logical_plan(sql).expect_err("query should have failed");
1638
1638
assert_eq!(
1639
-
"Error during planning: Projection references non-aggregate values: Expression aggregate_test_100.c13 could not be resolved from available columns: aggregate_test_100.c1, min(aggregate_test_100.c12)",
1639
+
"Error during planning: Column in SELECT must be in GROUP BY or an aggregate function: While expanding wildcard, column \"aggregate_test_100.c13\" must appear in the GROUP BY clause or must be part of an aggregate function, currently only \"aggregate_test_100.c1, min(aggregate_test_100.c12)\" appears in the SELECT clause satisfies this requirement",
# to associate it with other fields, aggregate should contain all the composite columns
3469
3469
# if any of the composite column is missing, we cannot use associated indices, inside select expression
3470
3470
# below query should fail
3471
-
statement error DataFusion error: Error during planning: Projection references non\-aggregate values: Expression r\.amount could not be resolved from available columns: r\.sn, sum\(l\.amount\)
3471
+
statement error DataFusion error: Error during planning: Column in SELECT must be in GROUP BY or an aggregate function: While expanding wildcard, column "r\.amount" must appear in the GROUP BY clause or must be part of an aggregate function, currently only "r\.sn, sum\(l\.amount\)" appears in the SELECT clause satisfies this requirement
3472
3472
SELECT r.sn, SUM(l.amount), r.amount
3473
3473
FROM sales_global_with_composite_pk AS l
3474
3474
JOIN sales_global_with_composite_pk AS r
@@ -3496,7 +3496,7 @@ NULL NULL NULL
3496
3496
# left join shouldn't propagate right side constraint,
3497
3497
# if right side is a unique key (unique and can contain null)
3498
3498
# Please note that, above query and this one is same except the constraint in the table.
3499
-
statement error DataFusion error: Error during planning: Projection references non\-aggregate values: Expression r\.amount could not be resolved from available columns: r\.sn, sum\(r\.amount\)
3499
+
statement error DataFusion error: Error during planning: Column in SELECT must be in GROUP BY or an aggregate function: While expanding wildcard, column "r\.amount" must appear in the GROUP BY clause or must be part of an aggregate function, currently only "r\.sn, sum\(r\.amount\)" appears in the SELECT clause satisfies this requirement
3500
3500
SELECT r.sn, r.amount, SUM(r.amount)
3501
3501
FROM (SELECT *
3502
3502
FROM sales_global_with_unique as l
@@ -3542,7 +3542,7 @@ SELECT column1, COUNT(*) as column2 FROM (VALUES (['a', 'b'], 1), (['c', 'd', 'e
3542
3542
3543
3543
3544
3544
# primary key should be aware from which columns it is associated
3545
-
statement error DataFusion error: Error during planning: Projection references non\-aggregate values: Expression r\.sn could not be resolved from available columns: l\.sn, l\.zip_code, l\.country, l\.ts, l\.currency, l\.amount, sum\(l\.amount\)
3545
+
statement error DataFusion error: Error during planning: Column in SELECT must be in GROUP BY or an aggregate function: While expanding wildcard, column "r\.sn" must appear in the GROUP BY clause or must be part of an aggregate function, currently only "l\.sn, l\.zip_code, l\.country, l\.ts, l\.currency, l\.amount, sum\(l\.amount\)" appears in the SELECT clause satisfies this requirement
3546
3546
SELECT l.sn, r.sn, SUM(l.amount), r.amount
3547
3547
FROM sales_global_with_pk AS l
3548
3548
JOIN sales_global_with_pk AS r
@@ -3633,7 +3633,7 @@ ORDER BY r.sn
3633
3633
4 100 2022-01-03T10:00:00
3634
3634
3635
3635
# after join, new window expressions shouldn't be associated with primary keys
3636
-
statement error DataFusion error: Error during planning: Projection references non\-aggregate values: Expression rn1 could not be resolved from available columns: r\.sn, r\.ts, r\.amount, sum\(r\.amount\)
3636
+
statement error DataFusion error: Error during planning: Column in SELECT must be in GROUP BY or an aggregate function: While expanding wildcard, column "rn1" must appear in the GROUP BY clause or must be part of an aggregate function, currently only "r\.sn, r\.ts, r\.amount, sum\(r\.amount\)" appears in the SELECT clause satisfies this requirement
3637
3637
SELECT r.sn, SUM(r.amount), rn1
3638
3638
FROM
3639
3639
(SELECT r.ts, r.sn, r.amount,
@@ -5135,7 +5135,7 @@ statement ok
5135
5135
CREATE TABLE test_case_expr(a INT, b TEXT) AS VALUES (1,'hello'), (2,'world')
5136
5136
5137
5137
query T
5138
-
SELECT (CASE WHEN CONCAT(b, 'hello') = 'test' THEN 'good' ELSE 'bad' END) AS c
5138
+
SELECT (CASE WHEN CONCAT(b, 'hello') = 'test' THEN 'good' ELSE 'bad' END) AS c
query error DataFusion error: Error during planning: Column in SELECT must be in GROUP BY or an aggregate function: While expanding wildcard, column "nested_unnest_table\.column1" must appear in the GROUP BY clause or must be part of an aggregate function, currently only "UNNEST\(nested_unnest_table\.column1\)\[c0\]" appears in the SELECT clause satisfies this requirement
799
799
select unnest(column1) c1 from nested_unnest_table group by c1.c0;
800
800
801
801
# TODO: this query should work. see issue: https://github.com/apache/datafusion/issues/12794
@@ -875,7 +875,7 @@ query TT
875
875
explain select * from unnest_table u, unnest(u.column1);
0 commit comments