Update on operate-on-columns.md (#3874)

Add fixed date in `range()` to ensure the query returns data. Select `location` column before `group()` to avoid error since different tables report `_value` in different types.

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>
Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>
pull/3980/head^2
Paweł Budzyński 2022-04-29 19:23:37 +02:00 committed by GitHub
parent 45a07eb84c
commit f6434fa2ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -38,9 +38,9 @@ This query:
```js
from(bucket: "noaa")
|> range(start: -30d)
|> group()
|> range(start: 2019-08-17)
|> keep(columns: ["location"])
|> group()
|> unique(column: "location")
```
@ -59,6 +59,8 @@ This query:
```js
from(bucket: "noaa")
|> range(start: 2019-08-17)
|> keep(columns: ["location"])
|> group()
|> unique(column: "location")
|> count(column: "location")
@ -83,8 +85,8 @@ The following query:
```js
from(bucket: "noaa")
|> range(start: 2019-08-17)
|> filter(fn: (r) => r._measurement == "average_temperature")
|> range(start: -30d)
|> map(fn: (r) => ({r with _value: (float(v: r._value) - 32.0) * 5.0 / 9.0} ))
```
@ -115,8 +117,8 @@ The following query:
```js
from(bucket: "noaa")
|> range(start: 2019-08-17)
|> filter(fn: (r) => r._measurement == "average_temperature")
|> range(start: -30d)
|> map(fn: (r) => ({r with celsius: (r._value - 32.0) * 5.0 / 9.0}))
```