Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
02b7d137
Commit
02b7d137
authored
Mar 06, 2016
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-9676: RANGE-type frames for window functions
Add testcases for RANGE UNBOUNDED PRECEDING|FOLLOWING
parent
1fa12cdf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
126 additions
and
0 deletions
+126
-0
mysql-test/r/win.result
mysql-test/r/win.result
+90
-0
mysql-test/t/win.test
mysql-test/t/win.test
+36
-0
No files found.
mysql-test/r/win.result
View file @
02b7d137
...
...
@@ -567,4 +567,94 @@ part_id pk val CNT
5678 206 2 4
5678 207 3 2
5678 208 3 2
#
# Try RANGE UNBOUNDED PRECEDING | FOLLOWING
#
select
part_id,
pk,
val,
count(val) over (partition by part_id
order by val
range between unbounded preceding and
current row)
as CNT
from t4;
part_id pk val CNT
1234 100 1 3
1234 101 1 3
1234 102 1 3
1234 103 2 7
1234 104 2 7
1234 105 2 7
1234 106 2 7
1234 107 3 9
1234 108 3 9
5678 200 1 3
5678 201 1 3
5678 202 1 3
5678 203 2 7
5678 204 2 7
5678 205 2 7
5678 206 2 7
5678 207 3 9
5678 208 3 9
select
part_id,
pk,
val,
count(val) over (partition by part_id
order by val
range between current row and
unbounded following)
as CNT
from t4;
part_id pk val CNT
1234 100 1 9
1234 101 1 9
1234 102 1 9
1234 103 2 6
1234 104 2 6
1234 105 2 6
1234 106 2 6
1234 107 3 2
1234 108 3 2
5678 200 1 9
5678 201 1 9
5678 202 1 9
5678 203 2 6
5678 204 2 6
5678 205 2 6
5678 206 2 6
5678 207 3 2
5678 208 3 2
select
part_id,
pk,
val,
count(val) over (partition by part_id
order by val
range between unbounded preceding and
unbounded following)
as CNT
from t4;
part_id pk val CNT
1234 100 1 9
1234 101 1 9
1234 102 1 9
1234 103 2 9
1234 104 2 9
1234 105 2 9
1234 106 2 9
1234 107 3 9
1234 108 3 9
5678 200 1 9
5678 201 1 9
5678 202 1 9
5678 203 2 9
5678 204 2 9
5678 205 2 9
5678 206 2 9
5678 207 3 9
5678 208 3 9
drop table t4;
mysql-test/t/win.test
View file @
02b7d137
...
...
@@ -384,5 +384,41 @@ select
as
CNT
from
t4
;
--
echo
#
--
echo
# Try RANGE UNBOUNDED PRECEDING | FOLLOWING
--
echo
#
select
part_id
,
pk
,
val
,
count
(
val
)
over
(
partition
by
part_id
order
by
val
range
between
unbounded
preceding
and
current
row
)
as
CNT
from
t4
;
select
part_id
,
pk
,
val
,
count
(
val
)
over
(
partition
by
part_id
order
by
val
range
between
current
row
and
unbounded
following
)
as
CNT
from
t4
;
select
part_id
,
pk
,
val
,
count
(
val
)
over
(
partition
by
part_id
order
by
val
range
between
unbounded
preceding
and
unbounded
following
)
as
CNT
from
t4
;
drop
table
t4
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment