influxdata / influxdata/ui

compound logical expressions in map failing with : runtime error: cannot use operand of type vector with logical and; expected boolean

Open
#5,619 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
117
Forks
51
Avg merge
2d 15h
Merged PRs (30d)
4

Description

Queries like the following have started to fail recently,
with the error
runtime error: cannot use operand of type vector with logical and; expected boolean
not sure if this is a UI or interpreter issue, but it has broken several production queries.

```
import "array"

rows = [
{Brake_Code_3: 1, Brake_Code_2: 0, Brake_Code_1: 1 ,BrakeEmergency:0},
{Brake_Code_3: 1, Brake_Code_2: 0, Brake_Code_1: 1 ,BrakeEmergency:0},
{Brake_Code_3: 1, Brake_Code_2: 0, Brake_Code_1: 1 ,BrakeEmergency:0},
{Brake_Code_3: 1, Brake_Code_2: 0, Brake_Code_1: 1 ,BrakeEmergency:0},
{Brake_Code_3: 1, Brake_Code_2: 0, Brake_Code_1: 1 ,BrakeEmergency:0},
]

data = array.from(rows: rows)
data |> map (fn: (r) => ( { r with
brakeStep:
if r.BrakeEmergency == 1 then 4.0
else if r.Brake_Code_3 ==1 and r.Brake_Code_2 == 1 and r.Brake_Code_1 == 1 then 0.0
else if r.Brake_Code_3 == 1 and r.Brake_Code_2 == 1 and r.Brake_Code_1 == 0 then 1.0
else if r.Brake_Code_3 == 1 and r.Brake_Code_2 == 0 and r.Brake_Code_1 == 1 then 2.0
else if r.Brake_Code_3 == 0 and r.Brake_Code_2 == 0 and r.Brake_Code_1 == 0 then 3.0
else 0.0
}) )


```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.