Skip to content

Preserve PromQL bool comparison modifier in pre-ASAP IR #306

Description

@milindsrivastava1997

What happened

These two PromQL expressions lower to byte-for-byte identical pre-ASAP IR:

left_vector == fill(30) right_vector
left_vector == bool fill(30) right_vector

The IR for both is:

{"BinaryOp":{"lhs":{"Scan":{"predicates":[],"schema":{"closed":false,"columns":[{"dtype":"timestamp","name":"ts","nullable":false,"table":null},{"dtype":"float64","name":"value","nullable":false,"table":null}],"time_index":0,"unique_keys":[]},"source":{"TimeSeries":{"metric":"left_vector"}}}},"op":{"Compare":"Eq"},"rhs":{"Scan":{"predicates":[],"schema":{"closed":false,"columns":[{"dtype":"timestamp","name":"ts","nullable":false,"table":null},{"dtype":"float64","name":"value","nullable":false,"table":null}],"time_index":0,"unique_keys":[]},"source":{"TimeSeries":{"metric":"right_vector"}}}},"vector_match":{"grouping":null,"kind":"Ignoring","labels":[]}}}

What I expected

The pre-ASAP IR should preserve the bool comparison modifier. A normal vector comparison filters out non-matching series, while a bool comparison retains matching series with a 0/1 value. These are different query semantics.

Steps to reproduce

  1. Run the PromQL corpus pre-ASAP dump command.
  2. Compare the per-query IR dumps for left_vector == fill(30) right_vector and left_vector == bool fill(30) right_vector.
  3. Observe that both have the same BinaryOp, comparison operator, operands, and vector matching metadata; no return-bool information is present.

Additional context

The corpus records are testdata queries 338 and 341. The dump also shows that the fill(30) modifier is absent from both IRs; this may be a separate or related unsupported modifier issue and should be assessed while fixing the bool distinction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    irPre-ASAP or post-ASAP intermediate representation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions