Skip to content

TraceQL: negated and union structural operators (!>, !<, !<<, &>, &<, &<<, &~) fail at the lexer #987

Open

Description

@rita7lopes

What

Most of TraceQL's negated and union structural operators fail at the lexer, before grammar matching starts:

query result
{.a="x"} !> {.b="y"} 1:10: lexer: invalid input text "!> ..."
{.a="x"} !< {.b="y"} 1:10: lexer: invalid input text "!< ..."
{.a="x"} !<< {.b="y"} 1:10: lexer: invalid input text "!<< ..."
{.a="x"} &> {.b="y"} 1:10: lexer: invalid input text "&> ..."
{.a="x"} &< {.b="y"} 1:10: lexer: invalid input text "&< ..."
{.a="x"} &<< {.b="y"} 1:10: lexer: invalid input text "&<< ..."
{.a="x"} &~ {.b="y"} 1:10: lexer: invalid input text "&~ ..."

!>> and &>> do parse, which is what makes this look like an incomplete token table rather than a deliberate omission.

Upstream Tempo defines the full set — pkg/traceql/lexer.go:56-63:

"!>":  NOT_CHILD     "&>":  UNION_CHILD
"!<":  NOT_PARENT    "&>>": UNION_DESC
"!>>": NOT_DESC      ...
"!<<": NOT_ANCE

and pkg/traceql/expr.y:156-164 maps each to an OpSpanset* operation.

Reproduction

_, err := traceql_parser.Parse(`{.a="x"} !> {.b="y"}`)
// 1:10: lexer: invalid input text "!> {.b=\"y\"} "

Scope

reader/traceql/traceql_parser/lexer_rules.go token table, plus the corresponding grammar alternations. Related to #986 (bare operators) — likely the same fix area, but a different failure layer (lexer vs parser), so tracked separately.

Credit

Found via @tsouza's parser-pin work in #925.

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