oceanbase / sql-lifecycle-management

SQL-Lifecycle-Management is an intelligent diagnosis and optimization product focusing on the SQL field.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: lead function is not support

Ifffff opened this issue · comments

commented

Describe the bug

select 
    distinct t.num as ConsecutiveNums 
from
(
    select
        num, 
        lag(num, 1, null) over(order by id) as lag_num, 
        lead(num, 1, null) over(order by id) as lead_num
    from Logs
) t
where t.num = t.lag_num and t.num = t.lead_num

an error happened when parser this sql.

E           SyntaxError: The current version does not support this SQL 30 (() 
E                    lag(num, 1, null) over(order by id) as lag_num, 
commented

It causes by the window function is not supported.

  • support window function in parser.
    • ROW_NUMBER
    • RANK
    • DENSE_RANK
    • CUME_DIST
    • PERCENT_RANK
    • NTILE
    • LEAD
    • LAG
    • FIRST_VALUE
    • LAST_VALUE
    • NTH_VALUE
  • support window function in format.
    • ROW_NUMBER
    • RANK
    • DENSE_RANK
    • CUME_DIST
    • PERCENT_RANK
    • NTILE
    • LEAD
    • LAG
    • FIRST_VALUE
    • LAST_VALUE
    • NTH_VALUE
  • support window function in optimize.
    • ROW_NUMBER
    • RANK
    • DENSE_RANK
    • CUME_DIST
    • PERCENT_RANK
    • NTILE
    • LEAD
    • LAG
    • FIRST_VALUE
    • LAST_VALUE
    • NTH_VALUE

Stale issue message