mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-9724: Window functions: Frame Exclusion support
Produce a "not supported" error if one attempts to exclude rows
This commit is contained in:
@ -1233,6 +1233,37 @@ count(*) over (order by a
|
|||||||
rows between current row and 3.14 following)
|
rows between current row and 3.14 following)
|
||||||
from t1;
|
from t1;
|
||||||
ERROR HY000: Integer is required for ROWS-type frame
|
ERROR HY000: Integer is required for ROWS-type frame
|
||||||
|
#
|
||||||
|
# EXCLUDE clause is parsed but not supported
|
||||||
|
#
|
||||||
|
select
|
||||||
|
count(*) over (order by a
|
||||||
|
rows between 1 preceding and 1 following
|
||||||
|
exclude current row)
|
||||||
|
from t1;
|
||||||
|
ERROR HY000: Frame exclusion is not supported yet
|
||||||
|
select
|
||||||
|
count(*) over (order by a
|
||||||
|
range between 1 preceding and 1 following
|
||||||
|
exclude ties)
|
||||||
|
from t1;
|
||||||
|
ERROR HY000: Frame exclusion is not supported yet
|
||||||
|
select
|
||||||
|
count(*) over (order by a
|
||||||
|
range between 1 preceding and 1 following
|
||||||
|
exclude group)
|
||||||
|
from t1;
|
||||||
|
ERROR HY000: Frame exclusion is not supported yet
|
||||||
|
select
|
||||||
|
count(*) over (order by a
|
||||||
|
rows between 1 preceding and 1 following
|
||||||
|
exclude no others)
|
||||||
|
from t1;
|
||||||
|
count(*) over (order by a
|
||||||
|
rows between 1 preceding and 1 following
|
||||||
|
exclude no others)
|
||||||
|
2
|
||||||
|
2
|
||||||
drop table t1;
|
drop table t1;
|
||||||
#
|
#
|
||||||
# Window function in grouping query
|
# Window function in grouping query
|
||||||
|
@ -762,6 +762,38 @@ select
|
|||||||
rows between current row and 3.14 following)
|
rows between current row and 3.14 following)
|
||||||
from t1;
|
from t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # EXCLUDE clause is parsed but not supported
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--error ER_FRAME_EXCLUSION_NOT_SUPPORTED
|
||||||
|
select
|
||||||
|
count(*) over (order by a
|
||||||
|
rows between 1 preceding and 1 following
|
||||||
|
exclude current row)
|
||||||
|
from t1;
|
||||||
|
|
||||||
|
--error ER_FRAME_EXCLUSION_NOT_SUPPORTED
|
||||||
|
select
|
||||||
|
count(*) over (order by a
|
||||||
|
range between 1 preceding and 1 following
|
||||||
|
exclude ties)
|
||||||
|
from t1;
|
||||||
|
|
||||||
|
--error ER_FRAME_EXCLUSION_NOT_SUPPORTED
|
||||||
|
select
|
||||||
|
count(*) over (order by a
|
||||||
|
range between 1 preceding and 1 following
|
||||||
|
exclude group)
|
||||||
|
from t1;
|
||||||
|
|
||||||
|
# EXCLUDE NO OTHERS means 'don't exclude anything'
|
||||||
|
select
|
||||||
|
count(*) over (order by a
|
||||||
|
rows between 1 preceding and 1 following
|
||||||
|
exclude no others)
|
||||||
|
from t1;
|
||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -7156,4 +7156,7 @@ ER_WRONG_TYPE_FOR_ROWS_FRAME
|
|||||||
eng "Integer is required for ROWS-type frame"
|
eng "Integer is required for ROWS-type frame"
|
||||||
ER_WRONG_TYPE_FOR_RANGE_FRAME
|
ER_WRONG_TYPE_FOR_RANGE_FRAME
|
||||||
eng "Numeric datatype is required for RANGE-type frame"
|
eng "Numeric datatype is required for RANGE-type frame"
|
||||||
|
ER_FRAME_EXCLUSION_NOT_SUPPORTED
|
||||||
|
eng "Frame exclusion is not supported yet"
|
||||||
|
ER_WINDOW_FUNCTION_DONT_HAVE_FRAME
|
||||||
|
eng "This window function may not have a window frame"
|
||||||
|
@ -127,6 +127,12 @@ setup_windows(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables,
|
|||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (win_spec->window_frame &&
|
||||||
|
win_spec->window_frame->exclusion != Window_frame::EXCL_NONE)
|
||||||
|
{
|
||||||
|
my_error(ER_FRAME_EXCLUSION_NOT_SUPPORTED, MYF(0));
|
||||||
|
DBUG_RETURN(1);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
For "win_func() OVER (ORDER BY order_list RANGE BETWEEN ...)",
|
For "win_func() OVER (ORDER BY order_list RANGE BETWEEN ...)",
|
||||||
- ORDER BY order_list must not be ommitted
|
- ORDER BY order_list must not be ommitted
|
||||||
|
Reference in New Issue
Block a user