From aa21c9492e1ee09b55fb9fc3fd0f0c5d8fc2df3a Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 13 May 2024 22:30:03 +0200 Subject: [PATCH] wip --- lib/logstorage/block_result.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/logstorage/block_result.go b/lib/logstorage/block_result.go index b5ac62dfb..e80a3516b 100644 --- a/lib/logstorage/block_result.go +++ b/lib/logstorage/block_result.go @@ -261,7 +261,14 @@ func (br *blockResult) mustInit(bs *blockSearch, bm *bitmap) { } // Initialize timestamps, since they are required for all the further work with br. + if !slices.Contains(bs.bsw.so.neededColumnNames, "_time") || slices.Contains(bs.bsw.so.unneededColumnNames, "_time") { + // The fastest path - _time column wasn't requested, so it is enough to initialize br.timestamps with zeroes. + rowsLen := bm.onesCount() + br.timestamps = fastnum.AppendInt64Zeros(br.timestamps[:0], rowsLen) + return + } + // Slow path - the _time column is requested, so we need to initialize br.timestamps with real timestamps. srcTimestamps := bs.getTimestamps() if bm.areAllBitsSet() { // Fast path - all the rows in the block are selected, so copy all the timestamps without any filtering.