mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 02:44:59 +00:00
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:
parent
d7d52d6b4e
commit
de61d04172
3 changed files with 47 additions and 5 deletions
13
api.go
13
api.go
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
2
go.sum
|
|
@ -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=
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue