Downsampling non-numerical data?

Hello Everybody!

I have been using InfluxDB for some time now to replace a few RRD databases. Now as the characteristics of a RRD are what I need (keeping data precise in shorter timeframes, but downsample down the line for older data), I decided to use InfluxDB as such.
I have defined retention policies and continuous queries for the downsampling. Everything works as expected, except for some measurements that contain non-numerical data. They represent the status of a system, which can have several distinct strings as values, but only one at a time. The values are correctly in the main database, but not in the downsampled one, which has a different retention policy.

Is it possible to downsample non-numerical data? I wonder what needs to go in the CQ, “mean()” does not really make sense here.

For your reference, here’s one of the continuous queries I use to downsample 1-minute data to 10-minute-data for 7-day storage precision.
SELECT mean() INTO database.“10m_for_7d”.:MEASUREMENT FROM database.“1m_for_24h”././ GROUP BY time(10m), *

The relevant retention policies are:
name duration shardGroupDuration replicaN default
1m_for_24h 24h0m0s 1h0m0s 1 true
10m_for_7d 168h0m0s 24h0m0s 1 false


Since that value represents the status you can use “Last()”, which will return the last status for the given time interval. it can be used with “group by” so you will get the correct data.
You will need to re-write your query to specify which fields are used in which function to avoid calculating the average of a text field.

SELECT mean(Field1),  mean(Field2), last(textField1)
INTO database.“10m_for_7d”.:MEASUREMENT 
FROM database.“1m_for_24h”././ 
GROUP BY time(10m), *

To avoid writing “mean(fieldX)” for each field you have you can try with a regex to include/exclude the text fields from an aggregation