Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Added support for creating range encoded frames. Added SetFieldValue,…
Browse files Browse the repository at this point in the history
…Average, Sum and Xor calls.
  • Loading branch information
yuce committed Sep 8, 2017
1 parent 980b3e8 commit 57aca6e
Show file tree
Hide file tree
Showing 7 changed files with 290 additions and 63 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ Go client for Pilosa high performance distributed bitmap index.

## Change Log

* **next**:
* **Next**:
* Dropped support for Go 1.7
* Added support for creating range encoded frames.
* Added `SetFieldValue`,`Average`, `Sum` and `Xor` calls.

* **v0.5.0** (2017-08-03):
* Supports imports and exports.
Expand Down
27 changes: 27 additions & 0 deletions client_it_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,33 @@ func TestFetchViews(t *testing.T) {
}
}

func TestRangeFrame(t *testing.T) {
client := getClient()
options := &FrameOptions{}
options.AddIntField("foo", 10, 20)
frame, _ := index.Frame("rangeframe", options)
client.EnsureFrame(frame)
_, err := client.Query(index.BatchQuery(
frame.SetBit(1, 10),
frame.SetBit(1, 100),
frame.SetIntFieldValue(10, "foo", 11),
frame.SetIntFieldValue(100, "foo", 15),
), nil)
if err != nil {
t.Fatal(err)
}
resp, err := client.Query(frame.Sum(frame.Bitmap(1), "foo"), nil)
if err != nil {
t.Fatal(err)
}
if resp.Result().Sum != 26 {
t.Fatalf("Sum 26 != %d", resp.Result().Sum)
}
if resp.Result().Count != 2 {
t.Fatalf("Count 2 != %d", resp.Result().Count)
}
}

func TestImportBitIteratorError(t *testing.T) {
client := getClient()
frame, err := index.Frame("not-important", nil)
Expand Down
161 changes: 103 additions & 58 deletions internal/public.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion internal/public.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ message Pair {
uint64 Count = 2;
}

message SumCount {
int64 Sum = 1;
int64 Count = 2;
}

message Bit {
uint64 RowID = 1;
uint64 ColumnID = 2;
Expand Down Expand Up @@ -40,8 +45,9 @@ message QueryRequest {
string Query = 1;
repeated uint64 Slices = 2;
bool ColumnAttrs = 3;
string Quantum = 4;
bool Remote = 5;
bool ExcludeAttrs = 6;
bool ExcludeBits = 7;
}

message QueryResponse {
Expand All @@ -54,6 +60,7 @@ message QueryResult {
Bitmap Bitmap = 1;
uint64 N = 2;
repeated Pair Pairs = 3;
SumCount SumCount = 5;
bool Changed = 4;
}

Expand Down
Loading

0 comments on commit 57aca6e

Please sign in to comment.