pub fn downsample(
batch: &RecordBatch,
value_column: &str,
bucket: &TimeBucket,
function: &AggFn,
memory_tracker: Option<&MemoryTracker>,
) -> Result<RecordBatch>Expand description
Downsample a RecordBatch into time buckets.
For each bucket [bucket.start_of(ts), bucket.next(start)), the
aggregation function is applied to the values in the value_column.
The bucket may be a fixed span or a calendar one — it is the same type
SQL’s time_bucket() and a rollup tier use, so the three agree.
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 aggregatebucket– the bucket width and the calendar it is read againstfunction– aggregation function to apply per bucket
§Errors
Returns an error if columns are missing or have unexpected types.