Unexport Row.IntersectionCount

This commit is contained in:
Cody Soyland 2018-07-05 21:53:23 -05:00
parent 3025586378
commit 018905fcd9
3 changed files with 7 additions and 7 deletions

View file

@ -566,7 +566,7 @@ func (f *fragment) sum(filter *Row, bitDepth uint) (sum, count uint64, err error
// Compute count based on the existence row.
row := f.row(uint64(bitDepth))
if filter != nil {
count = row.IntersectionCount(filter)
count = row.intersectionCount(filter)
} else {
count = row.Count()
}
@ -582,7 +582,7 @@ func (f *fragment) sum(filter *Row, bitDepth uint) (sum, count uint64, err error
row := f.row(uint64(i))
cnt := uint64(0)
if filter != nil {
cnt = row.IntersectionCount(filter)
cnt = row.intersectionCount(filter)
} else {
cnt = row.Count()
}
@ -938,7 +938,7 @@ func (f *fragment) top(opt topOptions) ([]Pair, error) {
// Calculate count and append.
count := cnt
if opt.Src != nil {
count = opt.Src.IntersectionCount(f.row(rowID))
count = opt.Src.intersectionCount(f.row(rowID))
}
if count == 0 {
continue
@ -982,7 +982,7 @@ func (f *fragment) top(opt topOptions) ([]Pair, error) {
// Calculate the intersecting column count and skip if it's below our
// last row in our current result set.
count := opt.Src.IntersectionCount(f.row(rowID))
count := opt.Src.intersectionCount(f.row(rowID))
if count < threshold {
continue
}

View file

@ -1063,7 +1063,7 @@ func BenchmarkFragment_IntersectionCount(b *testing.B) {
// Start benchmark
b.ResetTimer()
for i := 0; i < b.N; i++ {
if n := f.row(1).IntersectionCount(f.row(2)); n == 0 {
if n := f.row(1).intersectionCount(f.row(2)); n == 0 {
b.Fatalf("unexpected count: %d", n)
}
}

4
row.go
View file

@ -66,8 +66,8 @@ func (r *Row) Merge(other *Row) {
r.InvalidateCount()
}
// IntersectionCount returns the number of intersections between r and other.
func (r *Row) IntersectionCount(other *Row) uint64 {
// intersectionCount returns the number of intersections between r and other.
func (r *Row) intersectionCount(other *Row) uint64 {
var n uint64
itr := newMergeSegmentIterator(r.segments, other.segments)