Details
-
Sub-task
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
Description
We can define frame clause in window definition like
[ RANGE | ROWS ] frame_start [ RANGE | ROWS ] BETWEEN frame_start AND frame_end
, where frame_start and frame_end can be one of
UNBOUNDED PRECEDING value PRECEDING CURRENT ROW value FOLLOWING UNBOUNDED FOLLOWING
According to the window functions description of PostgreSQL(http://www.postgresql.org/docs/9.4/static/functions-window.html),
there are two types of window functions based on window frame support.
1) row_number, rank, dense_rank, percent_rank, cume_dist, tile, lag and lead:
these functions only work within window partition, which means window frame has no effect on these functions.
2) first_value, last_value, nth_value, and aggregation function as as window function: these functions should work with rows within window frame.
Currently, Tajo parser recognize the window frame grammar but windowAggExec does not use that information.
It works as if window frame is set as "RANGE BETWEEN UNBOUND PROCEEDING AND UNBOUNDED FOLLOWING", which is different from the default window frame setting of most DBMSs "RANGE BETWEEN UNBOUND PROCEEDING AND CURRENT ROW".
Following should be done:
1) Applying correct default window frame for first_value, last_value, nth_value, and aggregation functions .
2) Supporting various window frame expressions.