PromQL queries with binary operators after an `or` operator result in error
What type of bug is this?
Unexpected error
What subsystems are affected?
Query Engine
Minimal reproduce step
On a metric with data in the given time range, execute
{__name__="my_metric"} or {__name__="my_metric"} + 5
The actual query I want to run is
(delta({__name__="my_metric"}[1m] offset 15s) * 60) > 100
or
({__name__="my_metric"} * 0)
As a way to default missing/filtered values to 0. Usually I would use ... or label_replace(vector(0), ...), but label_replace isn't supported yet.
What did you expect to see?
The left query values being ORed with 0
What did you see instead?
PlanQuery: Internal error during building DataFusion plan: No field named my_metric."greptime_value * Float64(0)". Valid fields are my_metric.my_tag, my_metric.greptime_timestamp, "greptime_value * Float64(0)".
What operating system did you use?
Mac OS 15.1
What version of GreptimeDB did you use?
0.11.0
Relevant log output and stack trace
No response
Thanks for reporting this. It seems caused by column name mismatching, let me file a fix.
BTW, does this work for you as a workaround? (delta({__name__="my_metric"}[1m] offset 15s) * 60) > 100 or vector(0)
Thanks for getting on that so quickly.
BTW, does this work for you as a workaround? (delta({name="my_metric"}[1m] offset 15s) * 60) > 100 or vector(0)
No, because we expect the delta portion to return a series (or multiple series) with labels, which then won't match the vector(0) portion. This is a workaround because label_replace isn't ready.
I implemented the label_join and label_replace functions in #5153. Thank you for your report.
@waynexia Is this issue fixed?
Not sure if it is fixed @waynexia
I've verified on the latest v0.15.3 and it's fixed. Sorry for the late response