From cc5e822799162cb8f9b92902a76e994e1e45d523 Mon Sep 17 00:00:00 2001 From: Seebs Date: Wed, 16 Dec 2020 14:28:55 -0600 Subject: [PATCH] fix comment, remove unneeded step It turns out NewSliceBitmap can take an initial set of values already. --- fragment.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/fragment.go b/fragment.go index 1d222f655..654ba5b18 100644 --- a/fragment.go +++ b/fragment.go @@ -2525,7 +2525,7 @@ func sliceDifference(original, remove []uint64) []uint64 { n++ } } - return append(original[:n], original[on+1:]...) + return original[:n] } // bulkImportMutex performs a bulk import on a fragment while ensuring @@ -2541,12 +2541,9 @@ func (f *fragment) bulkImportMutex(tx Tx, rowIDs, columnIDs []uint64) error { columnIDs = p.cols rowIDs = p.rows - // create a mask of rows we care about - columns := roaring.NewSliceBitmap() - _, err := columns.AddN(columnIDs...) - if err != nil { - return errors.Wrap(err, "creating bitmap of affected columns") - } + // create a mask of columns we care about + columns := roaring.NewSliceBitmap(columnIDs...) + // we now need to find existing rows for these bits. rowSet := make(map[uint64]struct{}, len(rowIDs)) unsorted := false @@ -2579,7 +2576,7 @@ func (f *fragment) bulkImportMutex(tx Tx, rowIDs, columnIDs []uint64) error { return nil } findExisting := roaring.NewBitmapBitmapFilter(columns, callback) - err = tx.ApplyFilter(f.index(), f.field(), f.view(), f.shard, 0, findExisting) + err := tx.ApplyFilter(f.index(), f.field(), f.view(), f.shard, 0, findExisting) if err != nil { return errors.Wrap(err, "finding existing positions") }