A dashboard retains half of its raw points during normal operation and was changed to retain 60% during an incident. On Apache IoTDB 2.0.8 tree model, that small increase makes EQUAL_SIZE_BUCKET_AGG_SAMPLE return every input point. The dashboard therefore sends more data after enabling what should still be downsampling.
I reduced the incident sample to six evenly spaced values:
CREATE TIMESERIES root.operations_review_v11.dashboard_samples.value WITH DATATYPE=DOUBLE, ENCODING=PLAIN;
INSERT INTO root.operations_review_v11.dashboard_samples(timestamp, value) VALUES (1000, 10.0);
INSERT INTO root.operations_review_v11.dashboard_samples(timestamp, value) VALUES (2000, 20.0);
INSERT INTO root.operations_review_v11.dashboard_samples(timestamp, value) VALUES (3000, 30.0);
INSERT INTO root.operations_review_v11.dashboard_samples(timestamp, value) VALUES (4000, 40.0);
INSERT INTO root.operations_review_v11.dashboard_samples(timestamp, value) VALUES (5000, 50.0);
INSERT INTO root.operations_review_v11.dashboard_samples(timestamp, value) VALUES (6000, 60.0);
With the requested retention set to 60%, no aggregation occurs:
SELECT EQUAL_SIZE_BUCKET_AGG_SAMPLE(value, 'proportion'='0.6', 'type'='avg') AS sampled_value FROM root.operations_review_v11.dashboard_samples;
+-----------------------------+-------------+
| Time|sampled_value|
+-----------------------------+-------------+
|1970-01-01T08:00:01.000+08:00| 10.0|
|1970-01-01T08:00:02.000+08:00| 20.0|
|1970-01-01T08:00:03.000+08:00| 30.0|
|1970-01-01T08:00:04.000+08:00| 40.0|
|1970-01-01T08:00:05.000+08:00| 50.0|
|1970-01-01T08:00:06.000+08:00| 60.0|
+-----------------------------+-------------+
The production setting of 50% does aggregate adjacent pairs:
SELECT EQUAL_SIZE_BUCKET_AGG_SAMPLE(value, 'proportion'='0.5', 'type'='avg') AS sampled_value FROM root.operations_review_v11.dashboard_samples;
+-----------------------------+-------------+
| Time|sampled_value|
+-----------------------------+-------------+
|1970-01-01T08:00:01.000+08:00| 15.0|
|1970-01-01T08:00:03.000+08:00| 35.0|
|1970-01-01T08:00:05.000+08:00| 55.0|
+-----------------------------+-------------+
Why does a requested proportion of 0.6 produce six rows from six inputs while 0.5 produces three averaged rows? Is the internal bucket size truncated to int(1 / proportion), making every proportion above 0.5 behave as 1.0?