I would like to run a sliding window function in impala that finds the maximum price based on 5 minutes interval
in other words i want to compare the price of my current row with all rows in the last 5 minutes and write the maximum price
Analytical functions are usually bounded with row numbers, can they bounded by date as well?
ID, Timestamp, price
1, 2015-04-07 15:43:02, 230
2, 2015-04-07 15:44:04, 205
3, 2015-04-07 15:46:11, 220
4, 2015-04-07 15:48:02, 210
5, 2015-04-07 15:52:09, 200
6, 2015-04-07 15:53:32, 220
7, 2015-04-07 15:54:12, 207
8, 2015-04-07 15:57:33, 218
9, 2015-04-07 15:61:26, 221
10, 2015-04-07 15:61:01, 210
expected output:
ID, Timestamp, price, Max(price)
1, 2015-04-07 15:43:02, 230 230
2, 2015-04-07 15:44:04, 205 230
3, 2015-04-07 15:46:11, 220 230
4, 2015-04-07 15:48:01, 210 230
5, 2015-04-07 15:52:09, 200 210
6, 2015-04-07 15:53:32, 220 220
7, 2015-04-07 15:54:12, 207 220
8, 2015-04-07 15:57:33, 218 220
9, 2015-04-07 16:01:26, 221 221
10, 2015-04-07 16:07:51, 210 210