No results with `join.inner()` on generated data

Hello :wave:
I’m quite new to Flux lang and I’m having trouble testing the join.inner() function.

I tested it by joining data coming from real buckets or generated with array.from() function and all went ok.

Then I test it with data generated with generate.from() function by I can’t get any result back. Here the snippet failing to return expected result :

// Generate data
t1 =
    generate.from(
        count: 4,
        fn: (n) => n + 1,
        start: 2024-02-14T13:21:56Z,
        stop: 2024-02-14T13:22:36Z,
    )
        |> set(key: "tag", value: "foo")
        |> group(columns: ["_time"])
        |> yield(name: "t1")

t2 =
    generate.from(
        count: 4,
        fn: (n) => n + 2,
        start: 2024-02-14T13:21:56Z,
        stop: 2024-02-14T13:22:36Z,
    )
        |> set(key: "tag", value: "foo")
        |> group(columns: ["_time"])
        |> yield(name: "t2")

result = join.inner(
    left: t1,
    right: t2,
    on: (l, r) => l._time == r._time,
    as: (l, r) => ({l with rightValue: r._value}),
)
    |> yield(name: "RESULT")

Am I missing something? If I use the plain join() function everything works fine.

@sh3rlock14 I did some testing, and the way your query is structured, it’s suppressing an error. You assign the joined data to a variable, result, but you never call that variable. yeild() doesn’t surface the error from the join. But if you call the result variable, it returns an error:

t1 =
    generate.from(
        count: 4,
        fn: (n) => n + 1,
        start: 2024-02-14T13:21:56Z,
        stop: 2024-02-14T13:22:36Z,
    )
        |> set(key: "tag", value: "foo")
        |> group(columns: ["_time"])

t2 =
    generate.from(
        count: 4,
        fn: (n) => n + 2,
        start: 2024-02-14T13:21:56Z,
        stop: 2024-02-14T13:22:36Z,
    )
        |> set(key: "tag", value: "foo")
        |> group(columns: ["_time"])

result = join.inner(
    left: t1,
    right: t2,
    on: (l, r) => l._time == r._time,
    as: (l, r) => ({l with rightValue: r._value}),
)

result
Error: runtime error @23:10-28:2: inner: error preparing left side of join: table is missing label _start

Now, this begs the question, why does the join require a _start column? The join.inner function shouldn’t. I’m looking more into the error, but that’s why you weren’t getting any results from the join.