Documentation

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. experimental.distinct() is a selector function.

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 piped-forward 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

Was this page helpful?

Thank you for your feedback!


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.