Trying to join two influxdb v2 tables on field

Hello,
I’m trying to join two tables on _field column without success. The result table remains empty.

idTable = csv.from(csv: csvData, mode: "raw")
    |> map(fn: (r) => ({r with ID: int(v: r.ID)}))
    |> group(columns: ["ID"])

sandb = from(bucket: "sandb4")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] =~ /diag_stats_./)
  |> map(fn: (r) => ({r with _field: strings.replaceAll(v: r._field, t: "id_", u: "")}))
  |> map(fn: (r) => ({r with _field: int(v: r._field)}))
  |>last()
  |>group(columns: ["_field"])

join.inner(
    left: sandb,
    right: idTable,
    on: (l, r) => l._field == r.ID,
    as: (l, r) => ({EN: r.EN, ID: r.ID,_value:l._value}),
)

This is how these two streams look like:
idTable:

sandb:

Any suggestions?
Thank you in advance
Kai

Hi @kschrank

I think that the join is not working because idTable has 4 streams (1, 2, 3, 4), but possibly more since it appears to have 20 pages.
image

What happens without the |> group(columns: ["ID"]) function? What about just |> group() ?

1 Like

Thank you,
That was the right hint. It was neccessary to ungroup both streams.
Now it is working as expected.