Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PromQL queries with binary operators after an or operator result in error #5151

Open
dekelpilli opened this issue Dec 12, 2024 · 3 comments
Open
Assignees
Labels
C-bug Category Bugs

Comments

@dekelpilli
Copy link

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

@dekelpilli dekelpilli added the C-bug Category Bugs label Dec 12, 2024
@waynexia
Copy link
Member

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)

@waynexia waynexia self-assigned this Dec 12, 2024
@dekelpilli
Copy link
Author

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.

@killme2008
Copy link
Contributor

I implemented the label_join and label_replace functions in #5153. Thank you for your report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category Bugs
Projects
None yet
Development

No branches or pull requests

3 participants