You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2025/04/02 05:08:50 UTC
(skywalking-banyandb) branch main updated: Fix NPE (#639)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git
The following commit(s) were added to refs/heads/main by this push:
new 38148cad Fix NPE (#639)
38148cad is described below
commit 38148cadf62deb2c5c8decc90979d6a6e045b9d8
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Wed Apr 2 13:08:46 2025 +0800
Fix NPE (#639)
---
banyand/stream/index.go | 6 +++++-
pkg/query/logical/stream/index_filter.go | 20 ++++++++++++--------
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/banyand/stream/index.go b/banyand/stream/index.go
index 0d776078..cb2b2ebc 100644
--- a/banyand/stream/index.go
+++ b/banyand/stream/index.go
@@ -90,11 +90,15 @@ func (e *elementIndex) Search(ctx context.Context, seriesList []uint64, filter i
continue
}
if result == nil {
- result, resultTS = pl, plTS
+ result = pl
} else {
if err := result.Union(pl); err != nil {
return nil, nil, err
}
+ }
+ if resultTS == nil {
+ resultTS = plTS
+ } else {
if err := resultTS.Union(plTS); err != nil {
return nil, nil, err
}
diff --git a/pkg/query/logical/stream/index_filter.go b/pkg/query/logical/stream/index_filter.go
index 7b875862..be3f090b 100644
--- a/pkg/query/logical/stream/index_filter.go
+++ b/pkg/query/logical/stream/index_filter.go
@@ -211,22 +211,26 @@ func execute(searcher index.GetSearcher, seriesID common.SeriesID, n *node, lp l
if err != nil {
return nil, nil, err
}
- if result == nil {
- result = r
- continue
- }
- result, err = lp.merge(result, r)
- if err != nil {
+ if result, err = merge(result, r, lp); err != nil {
return nil, nil, err
}
- resultTS, err = lp.merge(resultTS, rt)
- if err != nil {
+ if resultTS, err = merge(resultTS, rt, lp); err != nil {
return nil, nil, err
}
}
return result, resultTS, nil
}
+func merge(result posting.List, list posting.List, lp logicalOP) (posting.List, error) {
+ if result == nil {
+ return list, nil
+ }
+ if list == nil {
+ return result, nil
+ }
+ return lp.merge(result, list)
+}
+
type andNode struct {
*node
}