Skip to content

SQL parsing into an AST fails on INTERVAL and SAMPLE statements #958

@eKrajnak

Description

@eKrajnak

What happened:
Clickhouse query which contains:

  • "INTERVAL 1 MINUTE" in where clause
    or
  • "FROM table SAMPLE 1/10"
    fails at SQL parsing into an AST when adhoc filter is applied

What you expected to happen:
Apply adhoc filter and perform query

How to reproduce it (as minimally and precisely as possible):

Apply any adhoc filter and run the query:

SELECT *
FROM data
SAMPLE 1/10
WHERE time > NOW() - INTERVAL 1 MINUTE

and watch javascript console log:

Unexpected int token: "1". Instead, I was expecting to see one of the following:

    - A "lparen" token
    - A "kw_cross" token
    - A "kw_left" token
    - A "kw_right" token
    - A "kw_full" token
    - A "comma" token
    - A "kw_inner" token
    - A "kw_where" token
    - A "kw_join" token
    - A "kw_group" token
    - A "kw_order" token
    - A "kw_offset" token
    - A "kw_for" token
    - A "kw_limit" token
    - A "kw_fetch" token
    - A "kw_union" token
    - A "semicolon" token

Environment:

  • Grafana version: 11.1.4 (2355de00c6)
  • Plugin version: 4.3.2
  • OS Grafana is installed on: Rocky Linux release 8.10 (Green Obsidian)
  • User OS & Browser: macOS 14.6.1 and Chrome 127.0.6533.120

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Waiting

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions