Closed tclass closed 7 years ago
Hello!
WebUI uses JSON, but our client libraries use protobuf content when they communicate with the Pilosa server, so there may be some differences. It looks like the response from the server cannot be decoded. We will look into that.
What version of Pilosa are you using? Do you use one of the release binaries, docker or did you compile it from the source?
I use the release binary and the SDK with the 0.4.0 version
I am trying to reproduce the error you've encountered but not wasn't successful so far. Here are a few more questions:
FrameOptions
object you are using for the frame
have any fields set other than RowLabel: "segment_id",
?func TestIntersectReturns(t *testing.T) {
client := getClient()
options := &FrameOptions{
RowLabel: "segment_id",
}
frame, err := index.Frame("segments", options)
if err != nil {
t.Fatal(err)
}
qry := index.Intersect(frame.Bitmap(2), frame.Bitmap(3))
response, err := client.Query(qry, nil)
if err != nil {
t.Fatal(err)
}
fmt.Println(response.Result().Bitmap.Bits)
}
I'm testing using the following code:
func TestIntersectReturns(t *testing.T) {
client := getClient()
options := &FrameOptions{
RowLabel: "segment_id",
}
frame, err := index.Frame("segments", options)
if err != nil {
t.Fatal(err)
}
err = client.EnsureFrame(frame)
if err != nil {
t.Fatal(err)
}
qry1 := index.BatchQuery(
frame.SetBit(2, 10),
frame.SetBit(2, 15),
frame.SetBit(3, 10),
frame.SetBit(3, 20),
)
client.Query(qry1, nil)
qry2 := index.Intersect(frame.Bitmap(2), frame.Bitmap(3))
response, err := client.Query(qry2, nil)
if err != nil {
t.Fatal(err)
}
if len(response.Results()) != 1 {
t.Fatal("There must be 1 result")
}
if !reflect.DeepEqual(response.Result().Bitmap.Bits, []uint64{10}) {
t.Fatal("Returned bits must be: [10]")
}
}
@tclass I've updated my comment with a non-destructive version of the test code which is OK to run on your Pilosa installation.
Thanks for responding that fast @yuce I found the problem this morning, I reused the index and frame variables and made them globals basically, that's why the error happend. Now it works
@tclass I'm glad the issue was resolved.
For the record, it's perfectly fine (even desired) to have the schema (index, frames) defined only once. The only constraint is the schema and its options (row label, time quantums, etc.) should represent what's on the server. Unfortunately this is currently not automatic but hopefully we won't need to define indexes and frames manually in the near-future.
Hi, I got the following error:
proto: can't skip unknown wire type 7 for internal.QueryResponse
The query works in the webUI:
Intersect(Bitmap(segment_id=2,frame='segments'), Bitmap(segment_id=3,frame='segments'))