diff --git a/api.go b/api.go index a1f1271ea..ffddc0702 100644 --- a/api.go +++ b/api.go @@ -302,7 +302,7 @@ func (api *API) Field(_ context.Context, indexName, fieldName string) (*Field, e // // It takes as input a roaring bitmap which it uses as the data for the // indicated index, field, and shard. The bitmap may be encoded according to the -// standard roaring spec (https://github.com/RoaringBitmap/RoaringFormatSpec), +// official roaring spec (https://github.com/RoaringBitmap/RoaringFormatSpec), // or to the pilosa roaring spec which supports 64 bit integers // (https://www.pilosa.com/docs/latest/architecture/#roaring-bitmap-storage-format). // diff --git a/fragment.go b/fragment.go index e551a2834..7f651b135 100644 --- a/fragment.go +++ b/fragment.go @@ -1422,7 +1422,7 @@ func (f *fragment) importValue(columnIDs, values []uint64, bitDepth uint) error return nil } -// importRoaring imports from standard roaring data format defined at +// importRoaring imports from the official roaring data format defined at // https://github.com/RoaringBitmap/RoaringFormatSpec or from pilosa's version // of the roaring format. The cache is updated to reflect the new data. func (f *fragment) importRoaring(data []byte) error { diff --git a/http/client.go b/http/client.go index e4e611c7b..1ab8bd04b 100644 --- a/http/client.go +++ b/http/client.go @@ -525,7 +525,8 @@ func (c *InternalClient) marshalImportValuePayload(index, field string, shard ui return buf, nil } -// ImportRoaring fast import of raw bits in roaring standard format +// ImportRoaring does fast import of raw bits in roaring format (pilosa or +// official format, see API.ImportRoaring). func (c *InternalClient) ImportRoaring(ctx context.Context, node *pilosa.Node, index, field string, shard uint64, data []byte) error { if index == "" { return pilosa.ErrIndexRequired diff --git a/roaring/roaring.go b/roaring/roaring.go index 2a2ed716f..41710de89 100644 --- a/roaring/roaring.go +++ b/roaring/roaring.go @@ -3349,7 +3349,7 @@ const ( serialCookie = 12347 // runs, arrays, and bitmaps ) -func readStandardHeader(buf []byte) (size uint32, containerTyper func(index uint, card int) byte, header, pos int, haveRuns bool, err error) { +func readOfficialHeader(buf []byte) (size uint32, containerTyper func(index uint, card int) byte, header, pos int, haveRuns bool, err error) { if len(buf) < 8 { err = fmt.Errorf("buffer too small, expecting at least 8 bytes, was %d", len(buf)) return size, containerTyper, header, pos, haveRuns, err @@ -3409,14 +3409,14 @@ func readStandardHeader(buf []byte) (size uint32, containerTyper func(index uint } // UnmarshalBinary decodes b from a binary-encoded byte slice. data can be in -// either standard roaring format or Pilosa's roaring format. +// either official roaring format or Pilosa's roaring format. func (b *Bitmap) UnmarshalBinary(data []byte) error { fileMagic := uint32(binary.LittleEndian.Uint16(data[0:2])) if fileMagic == magicNumber { // if pilosa roaring return errors.Wrap(b.unmarshalPilosaRoaring(data), "unmarshaling as pilosa roaring") } - keyN, containerTyper, header, pos, haveRuns, err := readStandardHeader(data) + keyN, containerTyper, header, pos, haveRuns, err := readOfficialHeader(data) if err != nil { return errors.Wrap(err, "reading roaring header") } @@ -3438,7 +3438,7 @@ func (b *Bitmap) UnmarshalBinary(data []byte) error { } else { err := readOffsets(b, data, pos, keyN) if err != nil { - return errors.Wrap(err, "reading offsets from standard roaring format") + return errors.Wrap(err, "reading offsets from official roaring format") } } return nil diff --git a/roaring/roaring_internal_test.go b/roaring/roaring_internal_test.go index caea8e2c1..b049d40cf 100644 --- a/roaring/roaring_internal_test.go +++ b/roaring/roaring_internal_test.go @@ -3228,13 +3228,13 @@ func runContainerFunc(f interface{}, c ...*Container) *Container { return nil } -func TestUnmarshalStdRoaring(t *testing.T) { +func TestUnmarshalOfficialRoaring(t *testing.T) { //generated serialize image from java(clojure) with arrays rbContainerWithTwoArrays, _ := hex.DecodeString("3A300000020000000000020001000000180000001E0000000100020003000100") bm := NewBitmap() er := bm.UnmarshalBinary(rbContainerWithTwoArrays) if er != nil { - t.Fatalf("UnmarshalStandardRoaring %s", er) + t.Fatalf("UnmarshalOfficialRoaring %s", er) } if bm.Count() != 4 { t.Fatalf("unexpected bitmap %v expected bits [1 2 3 65537]", bm.Slice()) @@ -3244,7 +3244,7 @@ func TestUnmarshalStdRoaring(t *testing.T) { bm = NewBitmap() er = bm.UnmarshalBinary(rbContainerWithRLEandArray) if er != nil { - t.Fatalf("UnmarshalStandardRoaring %s", er) + t.Fatalf("UnmarshalOfficialRoaring %s", er) } if bm.Count() != 11 { t.Fatalf("unexpected bitmap %v expected bits [1 2 3 4 5 6 7 8 9 10 65537]", bm.Slice()) @@ -3254,7 +3254,7 @@ func TestUnmarshalStdRoaring(t *testing.T) { bm = NewBitmap() er = bm.UnmarshalBinary(_bitmap_array_container) if er != nil { - t.Fatalf("UnmarshalStandardRoaring %s", er) + t.Fatalf("UnmarshalOfficialRoaring %s", er) } if bm.Count() != 10000 { t.Fatalf("expecting X got %d", bm.Count())