R.bucket reserved? Replaced with "" in dashboards

Grafana v10.2.6 (NA)

I have a influxdb instance with a table where one of the tags are called “bucket”. I can use it in other fluxql functions like sort, map etc. But when trying to use it in filter it is replace by ""

Entire query

from(bucket: "fixed_telemetry_historic")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r._measurement == "nuttcp_distrubution"
   and r._field == "bucket_mbps"
   and r.direction == "down"
   and r.bucket == "1"  // r.bucket in use
   )
  |> sort(columns:["bucket"])

From the querry inspector

from(bucket: "fixed_telemetry_historic")
  |> range(start: 2025-05-20T09:44:22.878Z, stop: 2025-05-21T09:44:22.878Z)
  |> filter(fn: (r) => r._measurement == "nuttcp_distrubution"
   and r._field == "bucket_mbps"
   and r.direction == "down"
   and "" == "1"   // wait? Where did my r.bucket go?
   )
  |> sort(columns:["bucket"])

When I run the same querry in influxdb’s web interface it returns the expected result from the table.

Is r.bucket reserved in grafana? If so it should be (better) documented. And it should produce an error in the UI so it is clear to the user. If it is not reserved, it seems I have stumbled across a bug which should be fixed.

It seems r.bucket is replaced with "" whenever it is written in the query. But functions which reference bucket alone does not get replaced.

from(bucket: "fixed_telemetry_historic")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r._measurement == "nuttcp_distrubution"
   and r._field == "bucket_mbps"
   and r.direction == "down"
   )
  |> rename(columns: {bucket: "bracket"})  // Transforming my bucket to a bracket.
  |> filter(fn: (r) => r.bracket == "1")  
  |> group()

Meaning I got a workaround for the moment. But the issue still stands. Bug or poorly documented feature and missing error report?

Looks like this is a feature. Check source code.

2 Likes

you will find this is the case with many other products such as sql etc, some words are reserved even though they might not be documented