You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tp: INTERVAL INTERSECTION OF pipelines clash with columns named interval in subqueries #8171
We want pipelines to work in more places than a top-level statement: as the source of another pipeline, and later as a WITH body:
FROM (FROM thread_state |>WHERE dur >0) |> INTERVAL FLATTEN ...
WITH finished AS (FROM thread_state |>WHERE dur >0)
FROM finished |> ...
To support these, the parser accepts a pipeline anywhere it accepts a subquery. That breaks ordinary SQL using a column named interval, as the android_netperf metric does:
SELECT (interval / 1e9) FROM t
After (, the parser has to decide on the spot whether interval is a column or the start of INTERVAL INTERSECTION OF. It picks the pipeline, then fails at /. Pipelines starting with FROM are fine, because FROM can never be a column.
The stopgap is to accept only FROM pipelines as subqueries, and INTERVAL INTERSECTION OF pipelines only as a whole statement, a CREATE PERFETTO TABLE body or a pipeline source. That is not acceptable as the final answer: an intersection is a pipeline like any other and has to work everywhere a pipeline does.
This must be settled before the pipe syntax is stabilized. The options:
Make intersection a stage, so every pipeline starts with FROM:
FROM a AS x |> INTERVAL INTERSECT (b AS y, c AS z) PER utid
The first operand becomes special, as with |> JOIN in GoogleSQL's pipe syntax, and existing pipelines need rewriting.
Keep the syntax and have the tokenizer treat interval as the keyword only when the next words are INTERSECTION OF. syntaqlite already does this for WINDOW, OVER and FILTER, but those are hard-coded in its runtime, so it needs a way for a dialect to declare its own. Checking OF as well matters: SELECT interval intersection FROM t is valid SQL, the column interval aliased as intersection. Nothing changes for users.
Reserve INTERVAL. Not viable: every column named interval would break.
Pipelines are still behind PERFETTO PRAGMA pipelines, so changing the syntax (option 1) is cheapest now.
changed the title [-]tp: INTERVAL INTERSECTION OF keeps pipelines from parsing as a select[/-][+]tp: INTERVAL INTERSECTION OF pipelines clash with columns named interval in subqueries[/+]on Oct 21, 2026
Activity
[-]tp: INTERVAL INTERSECTION OF keeps pipelines from parsing as a select[/-][+]tp: INTERVAL INTERSECTION OF pipelines clash with columns named interval in subqueries[/+]tp: parse a pipeline wherever SQLite parses a select
tp: parse a pipeline wherever SQLite parses a select
tp: parse a pipeline wherever SQLite parses a select (#8172)