influxdata / flux

Flux is a lightweight scripting language for querying databases (like InfluxDB) and working with data. It's part of InfluxDB 1.7 and 2.0, but can be run independently of those.

Home Page:https://influxdata.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Join does not work properly: maybe missing documentation

FStefanni opened this issue · comments

Hi,

I have taken the example of the documentation on the left join, and changed a little, and tested on InfluxDB.
This is the code:

import "array"
import "join"

left =
    array.from(
        rows: [
            {_time: 2022-01-01T00:00:00Z, _value: 1, label: "a"},
            {_time: 2022-01-02T00:00:00Z, _value: 2, label: "b"},
            {_time: 2022-01-03T00:00:00Z, _value: 3, label: "d"},
        ],
    )

right =
    array.from(
        rows: [
            {_time: 2022-01-01T00:00:00Z, _value: 0.4, id: "a"},
            {_time: 2022-01-02T00:00:00Z, _value: 0.5, id: "c"},
            {_time: 2022-01-03T00:00:00Z, _value: 0.6, id: "d"},
        ],
    )

join.left(
    left: left,
    right: right,
    on: (l, r) => l.label == r.id and l._time == r._time,
    as: (l, r) => r,
)

And the result is:

  • The correct columns _time, _value, id
  • Missing column label

In general, I have also done a lot of other tests on actual data, and very often the join result is bugged/unexpected.
So I am wandering whether there is a huge bug on join, or maybe there are some assumptions not written in the documentation.

Regards

This issue has had no recent activity and will be closed soon.