Changeset: 493d5fe3d33e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=493d5fe3d33e
Modified Files:
sql/test/miscellaneous/Tests/groupby_expressions.sql
sql/test/miscellaneous/Tests/groupby_expressions.stable.out
Branch: groupby-expressions
Log Message:
Testing aggregations with distinct values.
diffs (103 lines):
diff --git a/sql/test/miscellaneous/Tests/groupby_expressions.sql
b/sql/test/miscellaneous/Tests/groupby_expressions.sql
--- a/sql/test/miscellaneous/Tests/groupby_expressions.sql
+++ b/sql/test/miscellaneous/Tests/groupby_expressions.sql
@@ -8,25 +8,30 @@ select cast(("aa"+1) + ("bb"+1) as bigin
select cast(("aa"+1) + ("bb"+1) as bigint) from "groupings" group by ("aa"+1)
+ ("bb"+1);
select cast(sum("aa"+1) as bigint) from "groupings" group by "aa"+1;
+select cast(sum(distinct "aa"+1) as bigint) from "groupings" group by "aa"+1;
select cast(sum(("aa"+1) + ("bb"+2)) as bigint) from "groupings" group by
"aa"+1, "bb"+2;
select cast(sum(("aa"+1) + ("bb"+2)) as bigint) from "groupings" group by
("aa"+1) + ("bb"+2);
select cast("aa"+1 as bigint) from "groupings" group by "aa"+1 having "aa"+1 >
2;
select cast("aa"+1 as bigint) from "groupings" group by "aa"+1 order by "aa"+1;
-create function sumints(a int, b int) returns int begin return a + b; end;
+create function sumints("a" int, "b" int) returns int begin return "a" + "b";
end;
select count(*) from "groupings" group by sumints("aa","bb");
select sumints("aa","bb") from "groupings" group by sumints("aa","bb");
select cast(sumints("aa","bb")*sum("bb") as bigint) from "groupings" group by
sumints("aa","bb");
select cast(sum("bb") as bigint) from "groupings" group by
sumints("aa","bb")*sumints("aa",19);
-select count(*) from "groupings" group by "aa" > 1;
+select count("aa") from "groupings" group by "aa" > 1;
+select count(distinct "aa") from "groupings" group by "aa" > 1;
+select distinct count(distinct "aa") from "groupings" group by "aa" > 1;
select "aa" > 1 from "groupings" group by "aa" > 1;
select count(*) from "groupings" group by case when "aa" > 1 then "aa" else
"aa" + 10 end;
select case when "aa" > 1 then "aa" else "aa" * 4 end from "groupings" group
by case when "aa" > 1 then "aa" else "aa" * 4 end;
select cast(sum("aa"+"bb") as bigint) from "groupings" group by "aa"+"bb";
+select cast(sum(distinct "aa"+"bb") as bigint) from "groupings" group by
"aa"+"bb";
select cast(sum("aa"+3452) as bigint) from "groupings" group by "aa"+"bb";
+select cast(sum(distinct "aa"+3452) as bigint) from "groupings" group by
"aa"+"bb";
select count(*) from "groupings" having count("aa"-54) > 2;
select count(*) from "groupings" order by count("bb"+1);
diff --git a/sql/test/miscellaneous/Tests/groupby_expressions.stable.out
b/sql/test/miscellaneous/Tests/groupby_expressions.stable.out
--- a/sql/test/miscellaneous/Tests/groupby_expressions.stable.out
+++ b/sql/test/miscellaneous/Tests/groupby_expressions.stable.out
@@ -106,7 +106,14 @@ Ready.
% 1 # length
[ 4 ]
[ 3 ]
-#select cast(sum(("aa"+1) + ("bb"+1)) as bigint) from "groupings" group by
"aa"+1, "bb"+1;
+#select cast(sum(distinct "aa"+1) as bigint) from "groupings" group by "aa"+1;
+% sys.L4 # table_name
+% L4 # name
+% bigint # type
+% 1 # length
+[ 2 ]
+[ 3 ]
+#select cast(sum(("aa"+1) + ("bb"+2)) as bigint) from "groupings" group by
"aa"+1, "bb"+2;
% sys.L5 # table_name
% L5 # name
% bigint # type
@@ -171,6 +178,19 @@ Ready.
% 1 # length
[ 2 ]
[ 1 ]
+#select count(distinct "aa") from "groupings" group by "aa" > 1;
+% sys.L3 # table_name
+% L3 # name
+% bigint # type
+% 1 # length
+[ 1 ]
+[ 1 ]
+#select distinct count(distinct "aa") from "groupings" group by "aa" > 1;
+% sys.L3 # table_name
+% L3 # name
+% bigint # type
+% 1 # length
+[ 1 ]
#select "aa" > 1 from "groupings" group by "aa" > 1;
% sys.L1 # table_name
% L1 # name
@@ -199,6 +219,13 @@ Ready.
% 1 # length
[ 2 ]
[ 8 ]
+#select cast(sum(distinct "aa"+"bb") as bigint) from "groupings" group by
"aa"+"bb";
+% sys.L4 # table_name
+% L4 # name
+% bigint # type
+% 1 # length
+[ 2 ]
+[ 4 ]
#select cast(sum("aa"+3452) as bigint) from "groupings" group by "aa"+"bb";
% sys.L4 # table_name
% L4 # name
@@ -206,6 +233,13 @@ Ready.
% 4 # length
[ 3453 ]
[ 6907 ]
+#select cast(sum(distinct "aa"+3452) as bigint) from "groupings" group by
"aa"+"bb";
+% sys.L4 # table_name
+% L4 # name
+% bigint # type
+% 4 # length
+[ 3453 ]
+[ 6907 ]
#select count(*) from "groupings" having count("aa"-54) > 2;
% .L2 # table_name
% L2 # name
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list