failing test for group by with filter using string keys

also, apparently our API code was assuming that imports with keys
always had timestamps which seemed wrong, so I fixed that.
This commit is contained in:
Matt Jaffee 2019-05-10 13:55:21 -05:00
parent d7d52d6b4e
commit de61d04172
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF
3 changed files with 47 additions and 5 deletions

13
api.go
View file

@ -897,11 +897,14 @@ func (api *API) Import(ctx context.Context, req *ImportRequest, opts ...ImportOp
if _, ok := m[shard]; !ok {
m[shard] = make([]Bit, 0)
}
m[shard] = append(m[shard], Bit{
RowID: req.RowIDs[i],
ColumnID: colID,
Timestamp: req.Timestamps[i],
})
bit := Bit{
RowID: req.RowIDs[i],
ColumnID: colID,
}
if len(req.Timestamps) > 0 {
bit.Timestamp = req.Timestamps[i]
}
m[shard] = append(m[shard], bit)
}
// Signal to the receiving nodes to ignore checking for key translation.

View file

@ -3243,7 +3243,44 @@ func TestExecutor_Execute_Query_Error(t *testing.T) {
}
})
}
}
func TestExecutor_GroupByStrings(t *testing.T) {
c := test.MustRunCluster(t, 1)
defer c.Close()
c.CreateField(t, "istring", pilosa.IndexOptions{Keys: true}, "generals", pilosa.OptFieldKeys())
req := &pilosa.ImportRequest{
Index: "istring",
Field: "generals",
Shard: 0,
RowKeys: []string{"r1", "r2", "r1", "r2", "r1", "r2", "r1", "r2", "r1", "r2"},
ColumnKeys: []string{"c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "c10"},
}
if err := c[0].API.Import(context.Background(), req); err != nil {
t.Fatalf("importing: %v", err)
}
tests := []struct {
query string
}{
{
query: "GroupBy(Rows(generals), filter=Row(generals=r2))",
},
}
for i, test := range tests {
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
r, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{
Index: "istring",
Query: test.query,
})
if err != nil {
t.Fatalf("got an error %v", err)
}
fmt.Println(r)
})
}
}
func TestExecutor_Execute_Rows_Keys(t *testing.T) {

2
go.sum
View file

@ -109,6 +109,8 @@ github.com/uber/jaeger-client-go v2.16.0+incompatible h1:Q2Pp6v3QYiocMxomCaJuwQG
github.com/uber/jaeger-client-go v2.16.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-lib v1.5.0 h1:OHbgr8l656Ub3Fw5k9SWnBfIEwvoHQ+W2y+Aa9D1Uyo=
github.com/uber/jaeger-lib v1.5.0/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/uber/jaeger-lib v2.0.0+incompatible h1:iMSCV0rmXEogjNWPh2D0xk9YVKvrtGoHJNe9ebLu/pw=
github.com/uber/jaeger-lib v2.0.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4=