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
30c9450a
Commit
30c9450a
authored
Feb 05, 2016
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More comments
parent
e64b57a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
6 deletions
+44
-6
sql/item_windowfunc.h
sql/item_windowfunc.h
+39
-5
sql/sql_window.cc
sql/sql_window.cc
+5
-1
No files found.
sql/item_windowfunc.h
View file @
30c9450a
...
...
@@ -6,6 +6,13 @@
class
Window_spec
;
/*
ROW_NUMBER() OVER (...)
- This is a Window function (not just an aggregate)
- It can be computed by doing one pass over select output, provided
the output is sorted according to the window definition.
*/
class
Item_sum_row_number
:
public
Item_sum_int
{
...
...
@@ -31,12 +38,28 @@ class Item_sum_row_number: public Item_sum_int
};
/*
RANK() OVER (...) Windowing function
- This is a Window function (not just an aggregate)
- It can be computed by doing one pass over select output, provided
the output is sorted according to the window definition.
*/
class
Item_sum_rank
:
public
Item_sum_int
{
longlong
rank
;
void
clear
()
{}
bool
add
()
{
return
false
;
}
/*TODO: implementation is currently missing */
void
clear
()
{
// This is called on next partition
}
bool
add
()
{
return
false
;
}
void
update_field
()
{}
public:
...
...
@@ -55,10 +78,20 @@ class Item_sum_rank: public Item_sum_int
};
/*
RANK() OVER (...) Windowing function
- This is a Window function (not just an aggregate)
- It can be computed by doing one pass over select output, provided
the output is sorted according to the window definition.
*/
class
Item_sum_dense_rank
:
public
Item_sum_int
{
longlong
dense_rank
;
/* TODO: implementation is missing */
void
clear
()
{}
bool
add
()
{
return
false
;
}
void
update_field
()
{}
...
...
@@ -164,7 +197,7 @@ class Item_window_func : public Item_result_field
enum
Item
::
Type
type
()
const
{
return
Item
::
WINDOW_FUNC_ITEM
;
}
/*
TODO:
Window functions are very special functions, so val_() methods have
Window functions are very special functions, so val_() methods have
special meaning for them:
- Phase#1: we run the join and put its result into temporary table. For
...
...
@@ -179,6 +212,7 @@ class Item_window_func : public Item_result_field
- Phase#3: the temporary table is read and passed to query output.
However, Item_window_func still remains in the select list, so
item_windowfunc->val_int() will be called.
During Phase#3, read_value_from_result_field= true.
*/
private:
bool
read_value_from_result_field
;
...
...
sql/sql_window.cc
View file @
30c9450a
...
...
@@ -299,7 +299,11 @@ bool JOIN::process_window_functions(List<Item> *curr_fields_list)
*/
item_win
->
advance_window
();
/* Put the new value into temptable's field */
/*
Put the new value into temptable's field
TODO: Should this use item_win->update_field() call?
Regular aggegate function implementations seem to implement it.
*/
item_win
->
save_in_field
(
item_win
->
result_field
,
true
);
err
=
tbl
->
file
->
ha_update_row
(
tbl
->
record
[
1
],
tbl
->
record
[
0
]);
if
(
err
&&
err
!=
HA_ERR_RECORD_IS_THE_SAME
)
...
...
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