From f0d8284c8ac4126e5c78e95d830c1eefd27f9ecc Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 7 May 2024 13:45:23 +0200 Subject: [PATCH] wip --- lib/logstorage/parser.go | 5 ++++- lib/logstorage/pipe_sort.go | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/logstorage/parser.go b/lib/logstorage/parser.go index e1b1fb819..e62074eac 100644 --- a/lib/logstorage/parser.go +++ b/lib/logstorage/parser.go @@ -229,7 +229,7 @@ func (q *Query) getNeededColumns() []string { } dropFieldsNext := make(map[string]struct{}) for k := range m { - if referredFields[k] == 0 { + if k != "*" && referredFields[k] == 0 { dropFieldsNext[k] = struct{}{} } } @@ -266,6 +266,9 @@ func (q *Query) getNeededColumns() []string { dst = append(dst, f) } } + if a, ok := m["*"]; ok { + dst = append(dst, a...) + } input = normalizeFields(dst) if len(input) == 0 { break diff --git a/lib/logstorage/pipe_sort.go b/lib/logstorage/pipe_sort.go index 4e7995c3e..6018ec0a7 100644 --- a/lib/logstorage/pipe_sort.go +++ b/lib/logstorage/pipe_sort.go @@ -38,7 +38,14 @@ func (ps *pipeSort) String() string { } func (ps *pipeSort) getNeededFields() ([]string, map[string][]string) { - return []string{"*"}, nil + fields := make([]string, len(ps.byFields)) + for i, bf := range ps.byFields { + fields[i] = bf.name + } + m := map[string][]string{ + "*": fields, + } + return []string{"*"}, m } func (ps *pipeSort) newPipeProcessor(workersCount int, stopCh <-chan struct{}, cancel func(), ppBase pipeProcessor) pipeProcessor {