mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-09 04:17:51 +00:00
missed some files
This commit is contained in:
parent
f6db99a0e5
commit
7d897c1cf7
3 changed files with 63 additions and 42 deletions
|
|
@ -1,7 +1,6 @@
|
|||
package index
|
||||
|
||||
import (
|
||||
"log"
|
||||
"testing"
|
||||
|
||||
// "io/ioutil"
|
||||
|
|
@ -92,50 +91,63 @@ func TestFragment(t *testing.T) {
|
|||
So(num, ShouldEqual, 2)
|
||||
})
|
||||
|
||||
Convey("Brand SetBit", t, func() {
|
||||
bi1 := uint64(1231)
|
||||
bi2 := uint64(1232)
|
||||
bi3 := uint64(1233)
|
||||
bi4 := uint64(1234)
|
||||
Convey("Brand SetBit Small", t, func() {
|
||||
bi1 := uint64(1029)
|
||||
for x := uint64(0); x < 1000; x++ {
|
||||
if x < 100 {
|
||||
dummy.SetBit(brand, bi1, x)
|
||||
dummy.SetBit(brand, bi4, x)
|
||||
}
|
||||
if x < 500 {
|
||||
dummy.SetBit(brand, bi2, x)
|
||||
}
|
||||
if x%3 == 0 {
|
||||
dummy.SetBit(brand, bi3, x)
|
||||
}
|
||||
if x > 700 {
|
||||
dummy.SetBit(brand, bi4, x)
|
||||
}
|
||||
dummy.SetBit(brand, bi1, x)
|
||||
}
|
||||
bh1, _ := dummy.Get(brand, bi1)
|
||||
// dummy.Rank()
|
||||
log.Println(dummy.TopN(brand, bh1, 4))
|
||||
So(1, ShouldEqual, 1)
|
||||
})
|
||||
|
||||
/*
|
||||
Convey("Brand TopN", t, func() {
|
||||
max_brands := uint64(5000)
|
||||
for i := uint64(0); i < max_brands; i++ {
|
||||
for x := uint64(0); x < i; x = x + 1 {
|
||||
dummy.SetBit(brand, uint64(i), x)
|
||||
Convey("Brand SetBit Big", t, func() {
|
||||
bi1 := uint64(1231)
|
||||
bi2 := uint64(1232)
|
||||
bi3 := uint64(1233)
|
||||
bi4 := uint64(1234)
|
||||
for x := uint64(0); x < 60000; x++ {
|
||||
if x < 100 {
|
||||
dummy.SetBit(brand, bi1, x)
|
||||
dummy.SetBit(brand, bi4, x)
|
||||
}
|
||||
if x < 500 {
|
||||
dummy.SetBit(brand, bi2, x)
|
||||
}
|
||||
if x%3 == 0 && x < 1000 {
|
||||
dummy.SetBit(brand, bi3, x)
|
||||
}
|
||||
if x > 700 && x < 1000 {
|
||||
dummy.SetBit(brand, bi4, x)
|
||||
}
|
||||
if x > 1000 {
|
||||
dummy.SetBit(brand, x, x)
|
||||
}
|
||||
|
||||
}
|
||||
bh1, _ := dummy.Get(brand, uint64(4999))
|
||||
bh1, _ := dummy.Get(brand, bi1)
|
||||
// dummy.Rank()
|
||||
log.Println(dummy.TopN(brand, bh1, 4))
|
||||
|
||||
log.Println(dummy.Stats(brand))
|
||||
So(1, ShouldEqual, 1)
|
||||
})
|
||||
Convey("Brand TopN", t, func() {
|
||||
max_brands := uint64(5000)
|
||||
for i := uint64(0); i < max_brands; i++ {
|
||||
for x := uint64(0); x < i; x = x + 1 {
|
||||
dummy.SetBit(brand, uint64(i), x)
|
||||
}
|
||||
|
||||
}
|
||||
bh1, _ := dummy.Get(brand, uint64(4999))
|
||||
log.Println(dummy.TopN(brand, bh1, 4))
|
||||
|
||||
So(1, ShouldEqual, 1)
|
||||
})
|
||||
*/
|
||||
Convey("Clear ", t, func() {
|
||||
res, _ := dummy.Clear(general)
|
||||
So(res, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("store ", t, func() {
|
||||
b := uint64(1029)
|
||||
compressed := "H4sIAAAJbogA/2JmYRBQ+9/IzMjI6pxRmpfN+L+JgZGJkdk7tZKRjYGRNSwxpzSV8X8LAwOD8v9moDIup5z85GzHoqLESpAwI1AjWITxfxtQjdT/VqAIV7SxUWxpZl6JmQlImJGN0YGB4R+j+v8mJkaFH/8h4B+M8X+UgcwAhZTm/yZgMCLCarC4bbAxYGHFNBpWBBmwsGIeDSuCDFhYsYyGFUEGLKxYR8OKIAMWVmyjYUWQwcDwfyYwqNgHLKjk4Q7BBAAAAAD//wEAAP//QNipzzcJAAA="
|
||||
|
|
|
|||
|
|
@ -54,3 +54,10 @@ func (self *General) Store(bitmap_id uint64, bm IBitmap) {
|
|||
self.storage.Store(int64(bitmap_id), self.db, self.slice, bm.(*Bitmap))
|
||||
self.bitmap_cache.Add(bitmap_id, bm)
|
||||
}
|
||||
|
||||
func (self *General) Stats() interface{} {
|
||||
|
||||
stats := map[string]interface{}{
|
||||
"total size of cache in items": self.bitmap_cache.Len()}
|
||||
return stats
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,19 +25,21 @@ func TestStorage(t *testing.T) {
|
|||
So(BitCount(bm), ShouldEqual, 3)
|
||||
|
||||
})
|
||||
Convey("cassandra", t, func() {
|
||||
storage, _ := NewCassStorage("127.0.0.1", "hotbox")
|
||||
/*
|
||||
Convey("cassandra", t, func() {
|
||||
storage, _ := NewCassStorage("127.0.0.1", "hotbox")
|
||||
|
||||
bm := storage.Fetch(bitmap_id, db, slice)
|
||||
SetBit(bm, 0)
|
||||
SetBit(bm, 1)
|
||||
SetBit(bm, 2)
|
||||
storage.Store(int64(bitmap_id), db, slice, bm.(*Bitmap))
|
||||
bm2 := storage.Fetch(bitmap_id, db, slice)
|
||||
So(BitCount(bm), ShouldEqual, BitCount(bm2))
|
||||
So(BitCount(bm), ShouldEqual, bm.Count())
|
||||
So(BitCount(bm), ShouldEqual, 3)
|
||||
bm := storage.Fetch(bitmap_id, db, slice)
|
||||
SetBit(bm, 0)
|
||||
SetBit(bm, 1)
|
||||
SetBit(bm, 2)
|
||||
storage.Store(int64(bitmap_id), db, slice, bm.(*Bitmap))
|
||||
bm2 := storage.Fetch(bitmap_id, db, slice)
|
||||
So(BitCount(bm), ShouldEqual, BitCount(bm2))
|
||||
So(BitCount(bm), ShouldEqual, bm.Count())
|
||||
So(BitCount(bm), ShouldEqual, 3)
|
||||
|
||||
})
|
||||
})
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue