influxdata / influxdata/influxdb

mapped property values are reverted after applying additional filters

Open
#24,161 0 comments 0 reactions 0 assignees View on GitHub
area/flux
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

```javascript
import "date"

mapToDay = (tables=<-) => tables
|> map(fn: (r) => ({r with
// We must override _start and _stop in case they've been added by a previous |>range.
_start : today(),
_stop: date.add(d: 1d, to: today()),
originalTime: r._time,
_time: date.add(d: duration(v: string(v: 60 * date.hour(t: r._time) + date.minute(t: r._time)) + "m"), to: today())
}))

meters = from(bucket: "solar")
|> range(start: -1y, stop: 2023-03-27T20:00:00Z)
|> filter(fn: (r) => r["_measurement"] == "meters" and r["fuel"] == "gas")
|> mapToDay()
|> last()

meters |> yield(name: "raw")

meters |> aggregateWindow(every: 30m, fn: max, createEmpty: false) |> yield(name: "max")
```

![image](https://user-images.githubusercontent.com/12090617/228460743-fac0331b-d5b2-4a22-8548-7bc5d2273fed.png)

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied query and comparing the raw and max yields, focusing on the mapToDay transformation before last() and aggregateWindow(). Trace where the mapped properties are changed or discarded after the additional filtering and verify that the transformed values remain consistent in both results.

Written by the indexing model from the issue text.

Assessment

Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.