0

The goal is to join tables min and max returned by the following query:

data = from(bucket: "my_bucket")
    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)

min = data
    |> aggregateWindow(
        every: 1d, 
        fn: min,
        column: "_value")

max = data
    |> aggregateWindow(
        every: 1d, 
        fn: max,
        column: "_value")

The columns of max look like this:

+---------------------------------+
|             Columns             |
+---------------------------------+
| table MAX                       |
| _measurement GROUP STRING       |
| _field GROUP STRING             |
| _value NO GROUP DOUBLE          |
| _start GROUP DATETIME:RFC3339   |
| _stop GROUP DATETIME:RFC3339    |
| _time NO GROUP DATETIME:RFC3339 |
| env GROUP STRING                |
| path GROUP STRING               |
+---------------------------------+

The min table looks the same except the name of the first column. Both tables return data which can be confirmed by running yield(tables:min) or yield(tables:max). The join should be an inner join on columns _measurement, _field, _time, env and path and it should contain both the minimum and the maximum value _value of every window.

When I try to run within influxdb DataExplorer

join(tables: {min: min, max: max}, on: ["_time", "_field", "path", "_measurement", "env"], method: "inner")

I get the following error:

Failed to execute Flux query

When I run the job in Bash via influx query --file ./query.flux -r > ./query.csv; I get the following error:

Error: failed to execute query: 504 Gateway Timeout: unable to decode response content type "text/html; charset=utf-8"

No more logging-output is available to investigate the issue further. Whats wrong with this join?

Moritz Wolff
  • 436
  • 1
  • 7
  • 16

1 Answers1

0

join can only take two tables as the parameters according to this doc. You could try the union where it can take more than two tables as the input. See more details here.

You might just need to modify the script as below:

union(tables: [min: min, max: max]
Munin
  • 1,576
  • 2
  • 19