influxdata / influxdata/influxdb

flux short circuit boolean evaluation not short circuiting!

Open
#19,132 5 comments 0 reactions 2 assignees Claimed by @jpacik View on GitHub
Lighthouse team/query
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

__Steps to reproduce:__
List the minimal actions needed to reproduce the behavior.

1. filter with a compound filter errors out with `cannot compile @ 21:19-22:54: unsupported binary expression string >= int`:
```
|> filter(fn: (r) =>
(r["_field"] == "offline_for" and r["_value"] >= 0))
```

__Expected behavior:__
all offline_for fields are floats, so i'd expect the left hand filter to only return float rows and the exit before passing non-float rows to the right hand side.

__Actual behavior:__
errors out with `cannot compile @ 21:19-22:54: unsupported binary expression string >= int`

__Workaround__
```
|> filter(fn: (r) => (r["_field"] == "offline_for"))
|> filter( fn: (r) => r["_value"] >= 0)
```
splitting up the filter into 2 rows works as expected

__Environment info:__
influx db cloud 2.0

__Other Context__
oddly, this seems to only manifest if I add another query before this compound query, trying it by itself works fine. you can shoot me an email or have support contact me if you need the full query

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.