我正在尝试使用 LAG 和 LEAD 函数从列中选择领先和滞后值。下面是表格和数据。
hive> select * from foo;
OK
a
1
2
3
4
5
6
7
8
9
Time taken: 0.923 seconds
当我尝试选择领先和滞后值时,会抛出以下错误。
hive> select LAG(a, 1) over (order by a) as previous, a, LEAD(a, 1) over (order by a) as next from foo;
FAILED: ParseException line 1:22 missing FROM at '(' near '(' in subquery source
line 1:23 cannot recognize input near 'order' 'by' 'a' in subquery source
如何解决tis问题?