Hi all,

I would like to invite review of the LTTB (Largest-Triangle-Three-Buckets)
table function for the Table Model.

Issue: https://github.com/apache/iotdb/issues/18532
PR:    https://github.com/apache/iotdb/pull/18725

LTTB downsamples a time series for visualization while keeping peaks and
valleys. It is a built-in table function and follows the argument and
window conventions of M4. N and SIZE are mutually exclusive:

-- target-count mode
SELECT * FROM LTTB(
  DATA => t PARTITION BY device ORDER BY time,
  TIMECOL => 'time',
  N => 500
);

-- count or time window mode
SELECT * FROM LTTB(
  DATA => t PARTITION BY device ORDER BY time,
  TIMECOL => 'time',
  SIZE => 1m,
  SLIDE => 1m
);

The discussion on #18532 settled the behavior this PR implements:

- In SIZE mode, each window is one LTTB bucket. Sampling keeps one anchor
chain per partition and participant column, including when SLIDE < SIZE.
- TIMECOL is a column name (TIMECOL => 'time'). The table argument uses the
same ORDER BY syntax as M4.
- Duplicate timestamps in the same partition fail with semantic error 701.
The same timestamp in different partitions is allowed.
- NULL values are ignored per column. The first and last eligible points
are preserved in target-count mode.

The branch is feat/lttb-table-function, and the latest commits address the
previous review comments. CI has not been reported on this branch yet.

Reviews are very welcome, especially on the sampling semantics, planner and
distributed execution, memory accounting, and tests. Could a committer
please help approve and run the CI workflows?

Thank you,
DaZuiZui

Reply via email to