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
0c223a96
Commit
0c223a96
authored
Feb 16, 2016
by
Vicențiu Ciorbaru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix review comments.
parent
9a673e0a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
10 deletions
+18
-10
mysql-test/r/win.result
mysql-test/r/win.result
+1
-0
mysql-test/t/win.test
mysql-test/t/win.test
+1
-2
sql/item_windowfunc.cc
sql/item_windowfunc.cc
+8
-5
sql/item_windowfunc.h
sql/item_windowfunc.h
+8
-3
No files found.
mysql-test/r/win.result
View file @
0c223a96
...
...
@@ -135,3 +135,4 @@ pk a b rank() over (partition by b order by a) dense_rank() over (partition by b
7 2 20 1 1
9 4 20 4 2
10 4 20 4 2
drop table t3;
mysql-test/t/win.test
View file @
0c223a96
...
...
@@ -109,5 +109,4 @@ insert into t3 values
select
pk
,
a
,
b
,
rank
()
over
(
order
by
a
),
dense_rank
()
over
(
order
by
a
)
from
t3
;
select
pk
,
a
,
b
,
rank
()
over
(
partition
by
b
order
by
a
),
dense_rank
()
over
(
partition
by
b
order
by
a
)
from
t3
;
drop
table
tr
;
drop
table
t3
;
sql/item_windowfunc.cc
View file @
0c223a96
...
...
@@ -36,7 +36,8 @@ Item_window_func::fix_fields(THD *thd, Item **ref)
void
Item_window_func
::
setup_partition_border_check
(
THD
*
thd
)
{
for
(
ORDER
*
curr
=
window_spec
->
partition_list
.
first
;
curr
;
curr
=
curr
->
next
)
{
for
(
ORDER
*
curr
=
window_spec
->
partition_list
.
first
;
curr
;
curr
=
curr
->
next
)
{
//curr->item_ptr->fix_fields(thd, curr->item);
Cached_item
*
tmp
=
new_Cached_item
(
thd
,
curr
->
item
[
0
],
TRUE
);
partition_fields
.
push_back
(
tmp
);
...
...
@@ -48,7 +49,8 @@ void Item_window_func::setup_partition_border_check(THD *thd)
void
Item_sum_rank
::
setup_window_func
(
THD
*
thd
,
Window_spec
*
window_spec
)
{
/* TODO: move this into Item_window_func? */
for
(
ORDER
*
curr
=
window_spec
->
order_list
.
first
;
curr
;
curr
=
curr
->
next
)
{
for
(
ORDER
*
curr
=
window_spec
->
order_list
.
first
;
curr
;
curr
=
curr
->
next
)
{
Cached_item
*
tmp
=
new_Cached_item
(
thd
,
curr
->
item
[
0
],
TRUE
);
orderby_fields
.
push_back
(
tmp
);
}
...
...
@@ -58,7 +60,8 @@ void Item_sum_rank::setup_window_func(THD *thd, Window_spec *window_spec)
void
Item_sum_dense_rank
::
setup_window_func
(
THD
*
thd
,
Window_spec
*
window_spec
)
{
/* TODO: consider moving this && Item_sum_rank's implementation */
for
(
ORDER
*
curr
=
window_spec
->
order_list
.
first
;
curr
;
curr
=
curr
->
next
)
{
for
(
ORDER
*
curr
=
window_spec
->
order_list
.
first
;
curr
;
curr
=
curr
->
next
)
{
Cached_item
*
tmp
=
new_Cached_item
(
thd
,
curr
->
item
[
0
],
TRUE
);
orderby_fields
.
push_back
(
tmp
);
}
...
...
@@ -90,10 +93,10 @@ void Item_window_func::advance_window() {
int
changed
=
test_if_group_changed
(
partition_fields
);
if
(
changed
>
-
1
)
{
if
(
changed
>
-
1
)
{
/* Next partition */
window_func
->
clear
();
}
window_func
->
add
();
}
sql/item_windowfunc.h
View file @
0c223a96
...
...
@@ -157,13 +157,18 @@ class Item_sum_dense_rank: public Item_sum_int
{
longlong
dense_rank
;
List
<
Cached_item
>
orderby_fields
;
/* TODO: implementation is missing */
void
clear
()
{
/*
XXX(cvicentiu) This class could potentially be implemented in the rank
class, with a switch for the DENSE case.
*/
void
clear
()
{
dense_rank
=
1
;
}
bool
add
();
void
update_field
()
{}
longlong
val_int
()
{
longlong
val_int
()
{
return
dense_rank
;
}
...
...
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