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
6ad9ac21
Commit
6ad9ac21
authored
Mar 24, 2016
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encapsulate use of List<Cached_item> in a Group_bound_tracker.
parent
c7a60de7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
17 deletions
+9
-17
sql/item_windowfunc.cc
sql/item_windowfunc.cc
+4
-11
sql/item_windowfunc.h
sql/item_windowfunc.h
+2
-2
sql/sql_window.cc
sql/sql_window.cc
+3
-4
No files found.
sql/item_windowfunc.cc
View file @
6ad9ac21
...
@@ -164,12 +164,7 @@ void Item_window_func::split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array,
...
@@ -164,12 +164,7 @@ void Item_window_func::split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array,
void
Item_window_func
::
setup_partition_border_check
(
THD
*
thd
)
void
Item_window_func
::
setup_partition_border_check
(
THD
*
thd
)
{
{
for
(
ORDER
*
curr
=
window_spec
->
partition_list
->
first
;
curr
;
curr
=
curr
->
next
)
partition_tracker
.
init
(
thd
,
window_spec
->
partition_list
);
{
//curr->item_ptr->fix_fields(thd, curr->item);
Cached_item
*
tmp
=
new_Cached_item
(
thd
,
curr
->
item
[
0
],
TRUE
);
partition_fields
.
push_back
(
tmp
);
}
window_func
()
->
setup_window_func
(
thd
,
window_spec
);
window_func
()
->
setup_window_func
(
thd
,
window_spec
);
}
}
...
@@ -208,16 +203,14 @@ bool Item_sum_rank::add()
...
@@ -208,16 +203,14 @@ bool Item_sum_rank::add()
return
false
;
return
false
;
}
}
int
Item_window_func
::
check_partition_boun
d
()
bool
Item_window_func
::
check_if_partition_change
d
()
{
{
return
test_if_group_changed
(
partition_fields
);
return
partition_tracker
.
check_if_next_group
(
);
}
}
void
Item_window_func
::
advance_window
()
void
Item_window_func
::
advance_window
()
{
{
int
changed
=
check_partition_bound
();
if
(
check_if_partition_changed
())
if
(
changed
>
-
1
)
{
{
/* Next partition */
/* Next partition */
window_func
()
->
clear
();
window_func
()
->
clear
();
...
...
sql/item_windowfunc.h
View file @
6ad9ac21
...
@@ -485,7 +485,7 @@ class Item_window_func : public Item_func_or_sum
...
@@ -485,7 +485,7 @@ class Item_window_func : public Item_func_or_sum
advance_window() uses this to tell when we've left one partition and
advance_window() uses this to tell when we've left one partition and
entered another
entered another
*/
*/
List
<
Cached_item
>
partition_fields
;
Group_bound_tracker
partition_tracker
;
public:
public:
Item_window_func
(
THD
*
thd
,
Item_sum
*
win_func
,
LEX_STRING
*
win_name
)
Item_window_func
(
THD
*
thd
,
Item_sum
*
win_func
,
LEX_STRING
*
win_name
)
:
Item_func_or_sum
(
thd
,
(
Item
*
)
win_func
),
:
Item_func_or_sum
(
thd
,
(
Item
*
)
win_func
),
...
@@ -537,7 +537,7 @@ class Item_window_func : public Item_func_or_sum
...
@@ -537,7 +537,7 @@ class Item_window_func : public Item_func_or_sum
void
setup_partition_border_check
(
THD
*
thd
);
void
setup_partition_border_check
(
THD
*
thd
);
void
advance_window
();
void
advance_window
();
int
check_partition_boun
d
();
bool
check_if_partition_change
d
();
enum_field_types
field_type
()
const
enum_field_types
field_type
()
const
{
{
...
...
sql/sql_window.cc
View file @
6ad9ac21
...
@@ -1281,8 +1281,8 @@ bool compute_window_func_with_frames(Item_window_func *item_win,
...
@@ -1281,8 +1281,8 @@ bool compute_window_func_with_frames(Item_window_func *item_win,
{
{
break
;
/* End of file */
break
;
/* End of file */
}
}
bool
partition_changed
=
(
item_win
->
check_partition_bound
()
>
-
1
)
?
true
:
bool
partition_changed
=
item_win
->
check_if_partition_changed
();
false
;
tbl
->
file
->
position
(
tbl
->
record
[
0
]);
tbl
->
file
->
position
(
tbl
->
record
[
0
]);
memcpy
(
rowid_buf
,
tbl
->
file
->
ref
,
tbl
->
file
->
ref_length
);
memcpy
(
rowid_buf
,
tbl
->
file
->
ref
,
tbl
->
file
->
ref_length
);
...
@@ -1382,8 +1382,7 @@ bool compute_two_pass_window_functions(Item_window_func *item_win,
...
@@ -1382,8 +1382,7 @@ bool compute_two_pass_window_functions(Item_window_func *item_win,
done
=
true
;
done
=
true
;
}
}
bool
partition_changed
=
(
done
||
item_win
->
check_partition_bound
()
>
-
1
)
?
bool
partition_changed
=
done
||
item_win
->
check_if_partition_changed
();
true
:
false
;
// The first time we always have a partition changed. Ignore it.
// The first time we always have a partition changed. Ignore it.
if
(
first_row
)
if
(
first_row
)
{
{
...
...
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