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
Copy file name to clipboardExpand all lines: datafusion/sqllogictest/test_files/subquery.slt
+36-6Lines changed: 36 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -433,17 +433,32 @@ logical_plan
433
433
08)----------TableScan: t1 projection=[t1_int]
434
434
435
435
#invalid_scalar_subquery
436
-
statement error DataFusion error: Invalid plan after Analyzer\ncaused by\nError during planning: Scalar subquery should only return one column, but found 2: t2.t2_id, t2.t2_name
436
+
statement error
437
437
SELECT t1_id, t1_name, t1_int, (select t2_id, t2_name FROM t2 WHERE t2.t2_id = t1.t1_int) FROM t1
438
+
----
439
+
DataFusion error: Invalid (non-executable) plan after Analyzer
440
+
caused by
441
+
Error during planning: Scalar subquery should only return one column, but found 2: t2.t2_id, t2.t2_name
442
+
438
443
439
444
#subquery_not_allowed
440
445
#In/Exist Subquery is not allowed in ORDER BY clause.
441
-
statement error DataFusion error: Invalid plan after Analyzer\ncaused by\nError during planning: In/Exist subquery can only be used in Projection, Filter, TableScan, Window functions, Aggregate and Join plan nodes, but was used in \[Sort: t1.t1_int IN \(<subquery>\) ASC NULLS LAST\]
446
+
statement error
442
447
SELECT t1_id, t1_name, t1_int FROM t1 order by t1_int in (SELECT t2_int FROM t2 WHERE t1.t1_id > t1.t1_int)
448
+
----
449
+
DataFusion error: Invalid (non-executable) plan after Analyzer
450
+
caused by
451
+
Error during planning: In/Exist subquery can only be used in Projection, Filter, TableScan, Window functions, Aggregate and Join plan nodes, but was used in [Sort: t1.t1_int IN (<subquery>) ASC NULLS LAST]
452
+
443
453
444
454
#non_aggregated_correlated_scalar_subquery
445
-
statement error DataFusion error: Invalid plan after Analyzer\ncaused by\nError during planning: Correlated scalar subquery must be aggregated to return at most one row
455
+
statement error
446
456
SELECT t1_id, (SELECT t2_int FROM t2 WHERE t2.t2_int = t1.t1_int) as t2_int from t1
457
+
----
458
+
DataFusion error: Invalid (non-executable) plan after Analyzer
459
+
caused by
460
+
Error during planning: Correlated scalar subquery must be aggregated to return at most one row
461
+
447
462
448
463
#non_aggregated_correlated_scalar_subquery_unique
449
464
query II rowsort
@@ -456,12 +471,22 @@ SELECT t1_id, (SELECT t3_int FROM t3 WHERE t3.t3_id = t1.t1_id) as t3_int from t
456
471
457
472
458
473
#non_aggregated_correlated_scalar_subquery
459
-
statement error DataFusion error: Invalid plan after Analyzer\ncaused by\nError during planning: Correlated scalar subquery must be aggregated to return at most one row
474
+
statement error
460
475
SELECT t1_id, (SELECT t2_int FROM t2 WHERE t2.t2_int = t1_int group by t2_int) as t2_int from t1
476
+
----
477
+
DataFusion error: Invalid (non-executable) plan after Analyzer
478
+
caused by
479
+
Error during planning: Correlated scalar subquery must be aggregated to return at most one row
statement error DataFusion error: Invalid plan after Analyzer\ncaused by\nError during planning: Correlated scalar subquery must be aggregated to return at most one row
483
+
statement error
464
484
SELECT t1_id, (SELECT t2_int FROM t2 WHERE t2.t2_int = t1.t1_int limit 2) as t2_int from t1
485
+
----
486
+
DataFusion error: Invalid (non-executable) plan after Analyzer
487
+
caused by
488
+
Error during planning: Correlated scalar subquery must be aggregated to return at most one row
statement error DataFusion error: Invalid plan after Analyzer\ncaused by\nError during planning: A GROUP BY clause in a scalar correlated subquery cannot contain non-correlated columns
551
+
statement error
527
552
SELECT t1_id, (SELECT sum(t2_int) FROM t2 WHERE t2.t2_id = t1.t1_id group by t2_name) as t2_sum from t1
553
+
----
554
+
DataFusion error: Invalid (non-executable) plan after Analyzer
555
+
caused by
556
+
Error during planning: A GROUP BY clause in a scalar correlated subquery cannot contain non-correlated columns
0 commit comments