mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-06 19:07:50 +00:00
fix broken intersectionCallback functions
Two of the intersectionCallback functions were broken. In intersectionCallbackArrayArray, when checking to see whether we can skip ahead 8, we need to check whether that last value is lower than the one we're looking for, not whether the first value is. For intersectionCallbackArrayBitmap, actually implement it at all; it had never gotten modified significantly from the original intersectionCount, so it still counted and returned intersections, but never called the callback at all.
This commit is contained in:
parent
6dc8cd7b49
commit
0701f9b7dd
1 changed files with 9 additions and 5 deletions
|
|
@ -4493,10 +4493,13 @@ func intersectionCallbackArrayArray(a, b *Container, fn func(uint16)) {
|
|||
if (na << 2) < nb {
|
||||
for _, va := range ca {
|
||||
for cb[0] < va {
|
||||
if len(cb) > 8 && cb[0] < va {
|
||||
// try to skip ahead a bit faster
|
||||
for len(cb) > 7 && cb[7] < va {
|
||||
cb = cb[8:]
|
||||
}
|
||||
cb = cb[1:]
|
||||
for len(cb) > 0 && cb[0] < va {
|
||||
cb = cb[1:]
|
||||
}
|
||||
if len(cb) == 0 {
|
||||
return
|
||||
}
|
||||
|
|
@ -4585,7 +4588,7 @@ func intersectionCallbackBitmapRun(a, b *Container, fn func(uint16)) {
|
|||
}
|
||||
}
|
||||
|
||||
func intersectionCallbackArrayBitmap(a, b *Container, fn func(uint16)) (n int32) {
|
||||
func intersectionCallbackArrayBitmap(a, b *Container, fn func(uint16)) {
|
||||
statsHit("intersectionCount/ArrayBitmap")
|
||||
bitmap := b.bitmap()
|
||||
ln := len(bitmap)
|
||||
|
|
@ -4595,9 +4598,10 @@ func intersectionCallbackArrayBitmap(a, b *Container, fn func(uint16)) (n int32)
|
|||
break
|
||||
}
|
||||
off := val % 64
|
||||
n += int32(bitmap[i]>>off) & 1
|
||||
if (bitmap[i]>>off) & 1 != 0 {
|
||||
fn(val)
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func intersectionCallbackBitmapBitmap(a, b *Container, fn func(uint16)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue