pub fn downsample(
batch: &RecordBatch,
value_column: &str,
interval: i64,
function: &AggFn,
memory_tracker: Option<&MemoryTracker>,
) -> Result<RecordBatch>Expand description
Downsample a RecordBatch into fixed-width time buckets.
For each bucket [bucket_start, bucket_start + interval), the
aggregation function is applied to the values in the value_column.
Returns a new RecordBatch with two columns: _time (bucket start)
and the aggregated value column.
§Arguments
batch– input data (must have a_timeInt64 column)value_column– name of the column to aggregateinterval– bucket width in the same unit as timestamps (e.g. nanos)function– aggregation function to apply per bucket
§Errors
Returns an error if columns are missing or have unexpected types.