From bf2a0313828ec81bf7cc713a21f21f9555992d58 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Sat, 18 May 2024 23:33:35 +0200 Subject: [PATCH] wip --- lib/logstorage/block_result.go | 6 +++++- lib/logstorage/storage_search.go | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/logstorage/block_result.go b/lib/logstorage/block_result.go index 6508381c9..b3890ea0f 100644 --- a/lib/logstorage/block_result.go +++ b/lib/logstorage/block_result.go @@ -137,6 +137,9 @@ func (br *blockResult) initFromFilterNeededColumns(brSrc *blockResult, bm *bitma } func (br *blockResult) appendFilteredColumn(brSrc *blockResult, cSrc *blockResultColumn, bm *bitmap) { + if len(br.timestamps) == 0 { + return + } cDst := blockResultColumn{ name: cSrc.name, } @@ -210,7 +213,8 @@ func (br *blockResult) sizeBytes() int { // The returned result is valid only until rcs are modified. func (br *blockResult) setResultColumns(rcs []resultColumn) { br.reset() - if len(rcs) == 0 { + + if len(rcs) == 0 || len(rcs[0].values) == 0 { return } diff --git a/lib/logstorage/storage_search.go b/lib/logstorage/storage_search.go index 70dc7be04..dc80be15a 100644 --- a/lib/logstorage/storage_search.go +++ b/lib/logstorage/storage_search.go @@ -87,10 +87,15 @@ func (s *Storage) runQuery(ctx context.Context, tenantIDs []TenantID, q *Query, } pp := newDefaultPipeProcessor(func(workerID uint, br *blockResult) { + if len(br.timestamps) == 0 { + return + } + brs := getBlockRows() csDst := brs.cs - for _, c := range br.getColumns() { + cs := br.getColumns() + for _, c := range cs { values := c.getValues(br) csDst = append(csDst, BlockColumn{ Name: c.name,