diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2016-03-14 15:42:00 +0200 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2016-03-14 15:42:00 +0200 |
commit | a0c06ba1edb54c8c4705189c0455137a85658297 (patch) | |
tree | 12d26ba0e8298237247e44080624a54cfba4263a /mysql-test/r | |
parent | ce8a0d8e19e7bf1486a2c80ff6b7a30ef35bf99f (diff) | |
download | mariadb-git-a0c06ba1edb54c8c4705189c0455137a85658297.tar.gz |
Preliminary implementation for the aggregate sum function as a window function
This implementation does not deal with the case where removal of
elements from the window frame causes the item to turn to a null value.
Diffstat (limited to 'mysql-test/r')
-rw-r--r-- | mysql-test/r/win_sum.result | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/mysql-test/r/win_sum.result b/mysql-test/r/win_sum.result new file mode 100644 index 00000000000..1db6c6eefab --- /dev/null +++ b/mysql-test/r/win_sum.result @@ -0,0 +1,42 @@ +create table t1 ( +pk int primary key, +a int, +b int, +c real +); +insert into t1 values +(101 , 0, 10, 1.1), +(102 , 0, 10, 2.1), +(103 , 1, 10, 3.1), +(104 , 1, 10, 4.1), +(108 , 2, 10, 5.1), +(105 , 2, 20, 6.1), +(106 , 2, 20, 7.1), +(107 , 2, 20, 8.15), +(109 , 4, 20, 9.15), +(110 , 4, 20, 10.15), +(111 , 5, NULL, 11.15), +(112 , 5, 1, 12.25), +(113 , 5, NULL, 13.35), +(114 , 5, NULL, 14.50), +(115 , 5, NULL, 15.65); +select pk, a, b, sum(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), +sum(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +from t1; +pk a b sum(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) sum(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +101 0 10 20 3.2 +102 0 10 20 3.2 +103 1 10 20 7.199999999999999 +104 1 10 20 7.199999999999999 +105 2 20 40 13.2 +106 2 20 60 21.35 +107 2 20 50 20.35 +108 2 10 30 13.250000000000002 +109 4 20 40 19.3 +110 4 20 40 19.3 +111 5 NULL 1 23.4 +112 5 1 1 36.75 +113 5 NULL 1 40.1 +114 5 NULL 0 43.5 +115 5 NULL 0 30.15 +drop table t1; |