mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
rename standard roaring to "official" throughout
This commit is contained in:
parent
b2ec5e373e
commit
b412309447
5 changed files with 12 additions and 11 deletions
2
api.go
2
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).
|
||||
//
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue