Vladsz83 commented on a change in pull request #9606:
URL: https://github.com/apache/ignite/pull/9606#discussion_r757557903
##########
File path:
modules/calcite/src/test/sql/subquery/scalar/test_correlated_aggregate_subquery.test
##########
@@ -9,17 +9,102 @@ INSERT INTO integers VALUES (1), (2), (3), (NULL)
# correlated COUNT(*)
query II
-SELECT i, (SELECT COUNT(*) FROM integers i2 WHERE i2.i>i1.i) FROM integers i1
ORDER BY i NULLS FIRST;
+SELECT i, (SELECT COUNT(*) FROM integers i2 WHERE i2.i>i1.i) FROM integers i1
ORDER BY i;
----
NULL 0
1 2
2 1
3 0
+# aggregate with correlation inside aggregation
+query II
+SELECT i, (SELECT MIN(i+2*i1.i) FROM integers) FROM integers i1 ORDER BY i;
+----
+NULL NULL
+1 3
+2 5
+3 7
# this will fail, because "i" is not an aggregate but the SUM(i1.i) turns this
query into an aggregate
statement error
SELECT i, (SELECT SUM(i1.i)) FROM integers i1;
statement error
SELECT i+1, (SELECT SUM(i1.i)) FROM integers i1;
+
+# subquery inside aggregation
+query RR
+SELECT SUM(i), SUM((SELECT i FROM integers WHERE i=i1.i)) FROM integers i1;
+----
+6.000000 6.000000
+
+# aggregate with correlation in filter
+query II
+SELECT i, (SELECT MIN(i) FROM integers WHERE i>i1.i) FROM integers i1 ORDER BY
i;
Review comment:
Did it work before the fix?
--
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]