flux icon indicating copy to clipboard operation
flux copied to clipboard

Join Panic error

Open CDEguia opened this issue 4 years ago • 3 comments

When joining tables join.full returns internal error: panic: arrow/array: index out of range.

join.full(
  left: base,
  right: z_info,
  on: (l, r) => l.product == r.product,
  as: (l, r) => ({l with zscore: ((float(v: l._value) - r.mean) / r.dev) } ),
)

Note changing as:... to as: (l, r) => ({l with mean: r.mean, dev: r.dev}) also produced this error

This has only been seen with a subset of data and our current work around is to use the "Deprecated" join() function

CDEguia avatar Sep 13 '22 20:09 CDEguia

Have same error reliably when attempting to calculate CPU utilization using metrics reported by the inputs.kubernetes and inputs.kube_inventory Telegraf plugins:

import "join"

container = from(bucket: "hc-prod")
    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
    |> filter(fn: (r) => r._measurement == "kubernetes_pod_container")
    |> keep(columns: ["_time", "_field", "_value", "mc_zone", "namespace", "pod_name", "container_name"])
    |> group(columns: ["mc_zone", "namespace", "pod_name", "container_name"])

cpu_usage = container    
    |> filter(fn: (r) => r._field == "cpu_usage_nanocores")

cpu_limit = container 
    |> filter(fn: (r) => r._field == "resource_limits_millicpu_units")

join.inner(
     left: cpu_usage,
     right: cpu_limit,
     on: (l, r) => l.mc_zone == r.mc_zone and l.namespace == r.namespace and l.pod_name == r.pod_name and l.container_name == r.container_name,
     as: (l, r) => ({l with cpu_limit: r._value})

redbaron avatar Jan 25 '23 12:01 redbaron

OK, it seems that join panics when there are more than 1 row on the right to match. Either of these chagres stops it from crashing:

  1. Leave just one row on the right:
cpu_limit = container 
    |> filter(fn: (r) => r._field == "resource_limits_millicpu_units")
    |> last()
  1. or add l._time == r._time as join condition

redbaron avatar Jan 25 '23 12:01 redbaron

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

github-actions[bot] avatar Mar 27 '23 01:03 github-actions[bot]