Trying to join two influxdb v2 tables on field

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)}))
  |>group(columns: ["_field"])

    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:


Any suggestions?
Thank you in advance

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.

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.