impala滑动窗口

ugmeyewa  于 2021-06-26  发布在  Impala
关注(0)|答案(0)|浏览(521)

我想在 Impala 中运行一个滑动窗口函数,根据5分钟的间隔找到最高价格
换句话说,我想比较我的当前行的价格与过去5分钟内所有行的价格,并写出最高价格
分析函数通常以行号为界,它们也可以以日期为界吗?

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

预期产量:

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

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题