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
cc046fa9
Commit
cc046fa9
authored
Jun 26, 2017
by
Varun Gupta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A basic implementation of the add function is added
parent
18747a4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
sql/item_windowfunc.h
sql/item_windowfunc.h
+31
-4
No files found.
sql/item_windowfunc.h
View file @
cc046fa9
...
...
@@ -704,8 +704,8 @@ class Item_sum_ntile : public Item_sum_window_with_row_count
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
)
{}
Item_sum_percentile_disc
(
THD
*
thd
,
Item
*
arg
)
:
Item_sum_cume_dist
(
thd
,
arg
)
,
value
(
NULL
)
,
val_calculated
(
FALSE
)
{}
double
val_real
()
{
...
...
@@ -715,7 +715,18 @@ class Item_sum_percentile_disc : public Item_sum_cume_dist
return
0
;
}
null_value
=
false
;
return
0
;
return
((
Cached_item_int
*
)
value
)
->
get_value
();
}
longlong
val_int
()
{
if
(
get_row_count
()
==
0
||
get_arg
(
0
)
->
is_null
())
{
null_value
=
true
;
return
0
;
}
null_value
=
false
;
return
((
Cached_item_int
*
)
value
)
->
get_value
();
}
bool
add
()
...
...
@@ -724,6 +735,19 @@ class Item_sum_percentile_disc : public Item_sum_cume_dist
if
(
arg
->
is_null
())
return
true
;
/*implementation to be done*/
Item_sum_cume_dist
::
add
();
double
val1
=
Item_sum_cume_dist
::
val_real
();
/* need to check type and return value accordingly*/
double
val2
=
arg
->
val_real_from_decimal
();
/* use Cached_item to do the comparision using cmp_read_only() */
if
(
val1
>=
val2
&&
!
val_calculated
)
{
val_calculated
=
true
;
value
->
cmp
();
return
false
;
}
return
false
;
}
...
...
@@ -734,7 +758,9 @@ class Item_sum_percentile_disc : public Item_sum_cume_dist
void
clear
()
{
//need to implement
val_calculated
=
false
;
value
->
clear
();
Item_sum_cume_dist
::
clear
();
}
const
char
*
func_name
()
const
...
...
@@ -770,6 +796,7 @@ class Item_sum_percentile_disc : public Item_sum_cume_dist
private:
Cached_item
*
value
;
bool
val_calculated
;
};
...
...
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