Apache IoTDB M4 Function Data Loss Issue with Incomplete Windows
19:23 21 Dec 2025

When using Apache IoTDB 2.0.5's M4 sampling function, I found that when the total number of data points is not divisible by the window size, the processing result of incomplete windows doesn't meet expectations.

I have 10 data points:

  select value from `root.machine.sensor.point`
  +-----------------------------+-------------------------------+
  | `Time`|`root.machine.sensor.point.value`|
  +-----------------------------+-------------------------------+
  |2025-09-11T10:52:17.799+08:00| 9.0|
  |2025-09-11T10:52:30.341+08:00| 9.0|
  |2025-09-11T10:52:35.740+08:00| 6.0|
  |2025-09-11T10:52:44.439+08:00| 7.0|
  |2025-09-11T10:52:50.518+08:00| 5.0|
  |2025-09-11T10:52:54.749+08:00| 9.0|
  |2025-09-11T10:53:01.013+08:00| 8.0|
  |2025-09-11T10:53:05.941+08:00| 8.0|
  |2025-09-11T10:53:11.061+08:00| 8.0|
  |2025-09-11T10:53:18.693+08:00| 9.0|
  +-----------------------------+-------------------------------+

The query SQL I executed is :

  select m4(value,'windowSize'='7') from `root.machine.sensor.point`

And the result is :

  +-----------------------------+-----------------------------------------------------+
  | `Time`|m4(`root.machine.sensor.point.value`, \"windowSize\"=\"7\")|
  +-----------------------------+-----------------------------------------------------+
  |2025-09-11T10:52:17.799+08:00| 9.0|
  |2025-09-11T10:52:50.518+08:00| 5.0|
  |2025-09-11T10:53:01.013+08:00| 8.0|
  |2025-09-11T10:53:05.941+08:00| 8.0|
  |2025-09-11T10:53:18.693+08:00| 9.0|
  +-----------------------------+-----------------------------------------------------+

10 data points with windowSize=7should be divided into 2 windows. I expected the second window (last 3 points) to return all 3 points since there aren't enough points to select 4 distinct feature points. However, in the actual result, the second window only returned 2 points, and the data point with timestamp 2025-09-11T10:53:11.061+08:00is missing.

When the number of points in a window is less than the window size, does the M4 function still enforce the 4-point sampling logic? Whether this design is a feature or a bug?

apache-iotdb