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 208982aa Fix the latest version when merging top n results (#958)
208982aa is described below

commit 208982aaa11092bc38018a9e1b24eda67e829312
Author: peachisai <[email protected]>
AuthorDate: Sun Jan 25 16:57:59 2026 +0800

    Fix the latest version when merging top n results (#958)
---
 banyand/measure/block.go | 3 +++
 banyand/measure/query.go | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/banyand/measure/block.go b/banyand/measure/block.go
index 6cffb728..286f4bbf 100644
--- a/banyand/measure/block.go
+++ b/banyand/measure/block.go
@@ -777,6 +777,9 @@ func (bc *blockCursor) mergeTopNResult(r 
*model.MeasureResult, storedIndexValue
                                BinaryData: buf,
                        },
                }
+       }
+
+       if bc.versions[bc.idx] >= r.Versions[len(r.Versions)-1] {
                r.Versions[len(r.Versions)-1] = bc.versions[bc.idx]
        }
 }
diff --git a/banyand/measure/query.go b/banyand/measure/query.go
index 495e0304..18dc0904 100644
--- a/banyand/measure/query.go
+++ b/banyand/measure/query.go
@@ -200,7 +200,7 @@ func (m *measure) Query(ctx context.Context, mqo 
model.MeasureQueryOptions) (mqr
                }
        }
 
-       if mqo.Name == "_top_n_result" {
+       if mqo.Name == TopNSchemaName {
                result.topNQueryOptions = &topNQueryOptions{
                        sortDirection: mqo.Sort,
                        number:        mqo.Number,

Reply via email to