What happened
Two PromQL expressions with different derivative functions lower to byte-for-byte identical pre-ASAP IR:
rate(cumulative[5m])
irate(cumulative[5m])
The IR for both is:
{"Aggregate":{"child":{"TimeRange":{"child":{"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":"cumulative"}}}},"range":{"nanos":0,"secs":300}}},"having":null,"measures":[{"kind":"rate"}],"output_names":[""],"reduction":"PerEntity"}}
What I expected
The pre-ASAP IR should preserve the distinction between rate and irate, or explicitly document and justify a canonical representation that retains enough information for downstream execution to implement both semantics.
Steps to reproduce
- Run the PromQL corpus pre-ASAP dump command.
- Compare the per-query IR dumps for
rate(cumulative[5m]) and irate(cumulative[5m]).
- Observe that both have
Aggregate.measures[0].kind = "rate" and otherwise identical IR.
Additional context
PromQL defines different sampling behavior for rate and irate; collapsing both to AggIntent::Rate may make them execute identically. The corpus records are testdata queries 1757 and 1758.
What happened
Two PromQL expressions with different derivative functions lower to byte-for-byte identical pre-ASAP IR:
The IR for both is:
{"Aggregate":{"child":{"TimeRange":{"child":{"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":"cumulative"}}}},"range":{"nanos":0,"secs":300}}},"having":null,"measures":[{"kind":"rate"}],"output_names":[""],"reduction":"PerEntity"}}What I expected
The pre-ASAP IR should preserve the distinction between
rateandirate, or explicitly document and justify a canonical representation that retains enough information for downstream execution to implement both semantics.Steps to reproduce
rate(cumulative[5m])andirate(cumulative[5m]).Aggregate.measures[0].kind = "rate"and otherwise identical IR.Additional context
PromQL defines different sampling behavior for
rateandirate; collapsing both toAggIntent::Ratemay make them execute identically. The corpus records aretestdataqueries 1757 and 1758.