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.

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:00Zverv1
2021-01-01T00:01:00Zverv1
2021-01-01T00:02:00Zverv2
2021-01-01T00:03:00Zver
2021-01-01T00:04:00Zverv3
2021-01-01T00:05:00Zverv3
Output data
_value
v1
v2
v3

Select your region

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.