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
18747a4b
Commit
18747a4b
authored
Jun 26, 2017
by
Varun Gupta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added value field to Item_sum_percentile_disc
Check for single element in the order_list is added
parent
129626f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletion
+44
-1
sql/item_windowfunc.cc
sql/item_windowfunc.cc
+16
-0
sql/item_windowfunc.h
sql/item_windowfunc.h
+28
-1
No files found.
sql/item_windowfunc.cc
View file @
18747a4b
...
...
@@ -108,6 +108,17 @@ Item_window_func::fix_fields(THD *thd, Item **ref)
my_error
(
ER_NO_ORDER_LIST_IN_WINDOW_SPEC
,
MYF
(
0
),
window_func
()
->
func_name
());
return
true
;
}
if
(
only_single_element_order_list
())
{
// need to change the error, the error should say that we have more than one element in the order list
if
(
window_spec
->
order_list
->
elements
!=
1
)
{
my_error
(
ER_NO_ORDER_LIST_IN_WINDOW_SPEC
,
MYF
(
0
),
window_func
()
->
func_name
());
return
true
;
}
}
/*
TODO: why the last parameter is 'ref' in this call? What if window_func
decides to substitute itself for something else and does *ref=.... ?
...
...
@@ -194,6 +205,11 @@ void Item_sum_dense_rank::setup_window_func(THD *thd, Window_spec *window_spec)
clear
();
}
void
Item_sum_percentile_disc
::
setup_window_func
(
THD
*
thd
,
Window_spec
*
window_spec
)
{
setup_percentile_func
(
thd
,
window_spec
->
order_list
);
}
bool
Item_sum_dense_rank
::
add
()
{
if
(
peer_tracker
->
check_if_next_group
()
||
first_add
)
...
...
sql/item_windowfunc.h
View file @
18747a4b
...
...
@@ -705,7 +705,7 @@ class Item_sum_percentile_disc : public Item_sum_cume_dist
{
public:
Item_sum_percentile_disc
(
THD
*
thd
,
Item
*
arg
)
:
Item_sum_cume_dist
(
thd
,
arg
)
{}
value
(
NULL
)
{}
double
val_real
()
{
...
...
@@ -753,7 +753,23 @@ class Item_sum_percentile_disc : public Item_sum_cume_dist
Item
*
get_copy
(
THD
*
thd
,
MEM_ROOT
*
mem_root
)
{
return
get_item_copy
<
Item_sum_percentile_disc
>
(
thd
,
mem_root
,
this
);
}
void
setup_window_func
(
THD
*
thd
,
Window_spec
*
window_spec
);
void
setup_percentile_func
(
THD
*
thd
,
SQL_I_List
<
ORDER
>
*
list
)
{
value
=
new_Cached_item
(
thd
,
list
->
first
->
item
[
0
],
FALSE
);
}
void
cleanup
()
{
if
(
value
)
{
delete
value
;
value
=
NULL
;
}
Item_sum_num
::
cleanup
();
}
private:
Cached_item
*
value
;
};
...
...
@@ -871,6 +887,17 @@ class Item_window_func : public Item_func_or_sum
}
}
bool
only_single_element_order_list
()
const
{
switch
(
window_func
()
->
sum_func
()){
case
Item_sum
:
:
PERCENTILE_CONT_FUNC
:
case
Item_sum
:
:
PERCENTILE_DISC_FUNC
:
return
true
;
default:
return
false
;
}
}
/*
Computation functions.
TODO: consoder merging these with class Group_bound_tracker.
...
...
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