Skip to content
Snippets Groups Projects
Commit bfa6d910 authored by gwen-soleil's avatar gwen-soleil
Browse files

add support for LTTB downsampling on timescale.

parent f1c5100d
Branches
Tags
No related merge requests found
......@@ -117,7 +117,7 @@ public class TangoArchivingFetcherService {
}
/**
* Get values history between 2 timestamps, with sampling.
* Get values history between 2 timestamps, with sampling. Works only for scalar numeric attributes.
* Uses <a href="https://docs.timescale.com/api/latest/hyperfunctions/time_bucket/">Timescale hyperfunctions</a>
*
* @param attributeName The attribute name
......@@ -139,6 +139,20 @@ public class TangoArchivingFetcherService {
return archivingAttributeFetcher.getWithSampling(attributeName, samplingSQL, aggregateFunction, startTime, endTime);
}
/**
* Get an attribute's history between 2 timestamps, with LTTB sampling. Works only for scalar numeric attributes.
* Uses <a href="https://github.com/timescale/timescaledb-toolkit/blob/main/docs/lttb.md</a>
*
* @param attributeName The attribute name
* @param nbPoints The nb of points to return
* @param startTime The start timestamp
* @param endTime The end timestamp
* @return Sampled attribute values {@link AttributeValueSeries}
*/
public AttributeValueSeries getWithSamplingLttb(final String attributeName, int nbPoints, final Timestamp startTime, final Timestamp endTime) {
return archivingAttributeFetcher.getWithSamplingLttb(attributeName, nbPoints, startTime, endTime);
}
/**
* Get closest value of an attribute from a given timestamp
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment