From ac7bcfe40f04230415aa97d8378c2b7d121fd683 Mon Sep 17 00:00:00 2001 From: "GUY.MOLINARI" Date: Fri, 8 Nov 2024 17:10:45 +0000 Subject: [PATCH 1/2] Remove call to MaxBigValue for non-RANGE functions. --- roaring64/bsi64.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/roaring64/bsi64.go b/roaring64/bsi64.go index f459073e..65462b70 100644 --- a/roaring64/bsi64.go +++ b/roaring64/bsi64.go @@ -318,7 +318,7 @@ func (b *BSI) CompareBigValue(parallelism int, op Operation, valueOrStart, end * if valueOrStart == nil { valueOrStart = b.MinMaxBig(parallelism, MIN, &b.eBM) } - if end == nil { + if end == nil && op == RANGE { end = b.MinMaxBig(parallelism, MAX, &b.eBM) } @@ -386,7 +386,10 @@ func compareValue(e *task, batch []uint64, resultsChan chan *Bitmap, wg *sync.Wa } startIsNegative := e.valueOrStart.Sign() == -1 - endIsNegative := e.end.Sign() == -1 + endIsNegative := true + if e.end != nil { + endIsNegative = e.end.Sign() == -1 + } for i := 0; i < len(batch); i++ { cID := batch[i] @@ -735,12 +738,12 @@ func (b *BSI) ParOr(parallelism int, bsis ...*BSI) { bits := len(b.bA) for i := 0; i < len(bsis); i++ { if len(bsis[i].bA) > bits { - bits = bsis[i].BitCount() + bits = len(bsis[i].bA ) } } // Make sure we have enough bit slices - for bits > b.BitCount() { + for bits > len(b.bA) { bm := Bitmap{} bm.RunOptimize() b.bA = append(b.bA, bm) From c1e731e8a7f29381ca2e5cccdaf88db810355958 Mon Sep 17 00:00:00 2001 From: "GUY.MOLINARI" Date: Fri, 8 Nov 2024 21:02:16 +0000 Subject: [PATCH 2/2] Not needed for RANGE comparisons --- roaring64/bsi64.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roaring64/bsi64.go b/roaring64/bsi64.go index 65462b70..46dbe121 100644 --- a/roaring64/bsi64.go +++ b/roaring64/bsi64.go @@ -402,7 +402,7 @@ func compareValue(e *task, batch []uint64, resultsChan chan *Bitmap, wg *sync.Wa if isNegative != startIsNegative { compStartValue = twosComplement(e.valueOrStart, e.bsi.BitCount()+1) } - if isNegative != endIsNegative { + if isNegative != endIsNegative && e.end != nil { compEndValue = twosComplement(e.end, e.bsi.BitCount()+1) }