experimental.distinct() function
The experimental.distinct()
function is subject to change at any time.
By using this function, you accept the risks of experimental functions.
The experimental.distinct()
function returns unique values from the _value
column.
The _value
of each output record is set to a distinct value in the specified column.
null
is considered a distinct value.
Function type: Selector
import "experimental"
experimental.distinct()
Output schema
experimental.distinct()
outputs a single table for each input table and does
the following:
- Outputs a single record for each distinct value.
- Drops all columns not in the group key.
Empty tables
experimental.distinct()
drops empty tables.
Parameters
tables
Input data. Default is pipe-forwarded data.
Examples
Return distinct values for each input table
import "experimental"
data
|> experimental.distinct()
Input data
_time | _field | _value |
---|---|---|
2021-01-01T00:00:00Z | ver | v1 |
2021-01-01T00:01:00Z | ver | v1 |
2021-01-01T00:02:00Z | ver | v2 |
2021-01-01T00:03:00Z | ver | |
2021-01-01T00:04:00Z | ver | v3 |
2021-01-01T00:05:00Z | ver | v3 |
Output data
_value |
---|
v1 |
v2 |
v3 |
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.