Influxdb: DISTINCT(*) and DISTINCT(*regex*) returning error

Created on 14 Jun 2018  路  5Comments  路  Source: influxdata/influxdb

Hi!
InfluxDB documentation says that I can use DISTINCT(*) in my queries without specifying fields explicitly.

On executing query from the documentation SELECT DISTINCT(*) FROM "h2o_feet"
Expected behavior: list of distinct values for distinct_level_description , distinct_water_level
Actual behavior: InfluxDB returns the following error: ERR: expected field argument in distinct()

The same error if I try to put regex inside DISTINCT.

Was this feature removed? Please, update documentation then.

InfluxDB version 1.5.1

Most helpful comment

Sure, please, update documentation and official examples since it states opposite to what you say.

All 5 comments

You can only have one distinct() call in a query so a wildcard and a regex don't make any sense. As an example:

> select distinct(usage_user), distinct(usage_system) from telegraf..cpu
ERR: aggregate function distinct() cannot be combined with other functions or fields

So you have to specify a field for distinct().

Sure, please, update documentation and official examples since it states opposite to what you say.

@jsternberg I am quite sure it used to work like stated in the documentation, now my (fairly old) CQs return errors

So, does anyone now how to filter out "duplicate" rows / only get "unique" rows (ignoring the timestamp)? Following the InfluxDB docs, I was hoping that a DISTINCT(*) would do the trick ...

i am trying this SELECT DISTINCT(*) From db but getting error (experted filed argument in distinct)

Was this page helpful?
0 / 5 - 0 ratings