8000 tp: INTERVAL INTERSECTION OF pipelines clash with columns named interval in subqueries · Issue #8171 · google/perfetto · GitHub
[go: up one dir, main page]

Skip to content

tp: INTERVAL INTERSECTION OF pipelines clash with columns named interval in subqueries #8171

Open

Description

@LalitMaganti

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:

  1. 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.
  2. 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.
  3. 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.

Activity

  1. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0