Hello Igor,
I was trying to move JOIN::process_window_functions() from using
join->fields_list to using join->select_lex->window_funcs.
And I discovered that join->select_lex->window_funcs does not contain
window function items that use window definition. Is this intentional?
Example:
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (pk int, c int);
insert into t1 select a+1,1 from t0;
update t1 set c=2 where pk not in (1,2,3,4);
select pk, c,
count(*) over
(partition by c order by pk rows between 2 preceding and 2 following) as CNT
from t1
Here:
#1 0x0000555555af5db6 in AGGR_OP::end_send (this=0x7fff4c0086c8)
(gdb) p join->select_lex->window_funcs
$69 = {<base_list> = {<Sql_alloc> = {<No data fields>}, first =
0x7fff4c005d18, last = 0x7fff4c005d18, elements = 1}, <No data fields>}
But:
select pk, c,
count(*) over w1 as CNT
from t1
window w1 as (partition by c order by pk rows between 2 preceding and 2
following);
(gdb) p join->select_lex->window_funcs
$74 = {<base_list> = {<Sql_alloc> = {<No data fields>}, first =
0x555556d48820, last = 0x55555ab10b70, elements = 0}, <No data fields>}
BR
Sergei
--
Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog
_______________________________________________
Mailing list: https://launchpad.net/~maria-developers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~maria-developers
More help : https://help.launchpad.net/ListHelp