Skip to content

Commit 6abdf50

Browse files
authored
Merge pull request #107 from maciej/lazy-or-bitmap
FastOr: force using bitmap containers
2 parents 68da788 + d2fe324 commit 6abdf50

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

fastaggregation.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,17 @@ main:
3232
}
3333
s2 = x2.highlowcontainer.getKeyAtIndex(pos2)
3434
} else {
35+
c1 := x1.highlowcontainer.getContainerAtIndex(pos1)
36+
switch t := c1.(type) {
37+
case *arrayContainer:
38+
c1 = t.toBitmapContainer()
39+
case *runContainer16:
40+
if !t.isFull() {
41+
c1 = t.toBitmapContainer()
42+
}
43+
}
3544

36-
answer.highlowcontainer.appendContainer(s1, x1.highlowcontainer.getContainerAtIndex(pos1).lazyOR(x2.highlowcontainer.getContainerAtIndex(pos2)), false)
45+
answer.highlowcontainer.appendContainer(s1, c1.lazyOR(x2.highlowcontainer.getContainerAtIndex(pos2)), false)
3746
pos1++
3847
pos2++
3948
if (pos1 == length1) || (pos2 == length2) {
@@ -80,8 +89,17 @@ main:
8089
}
8190
s2 = x2.highlowcontainer.getKeyAtIndex(pos2)
8291
} else {
92+
c1 := x1.highlowcontainer.getContainerAtIndex(pos1)
93+
switch t := c1.(type) {
94+
case *arrayContainer:
95+
c1 = t.toBitmapContainer()
96+
case *runContainer16:
97+
if !t.isFull() {
98+
c1 = t.toBitmapContainer()
99+
}
100+
}
83101

84-
answer.highlowcontainer.appendContainer(s1, x1.highlowcontainer.getWritableContainerAtIndex(pos1).lazyIOR(x2.highlowcontainer.getContainerAtIndex(pos2)), false)
102+
answer.highlowcontainer.appendContainer(s1, c1.lazyIOR(x2.highlowcontainer.getContainerAtIndex(pos2)), false)
85103
pos1++
86104
pos2++
87105
if (pos1 == length1) || (pos2 == length2) {

0 commit comments

Comments
 (0)