fix executor tests which were expecting a signedrow from Distinct

This commit is contained in:
Matt Jaffee 2020-12-23 14:52:14 -06:00
parent 6ff6fa7bb8
commit 427e9cb538
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF

View file

@ -5434,9 +5434,9 @@ func TestExecutor_ForeignIndex(t *testing.T) {
if !sameStringSlice(distinct.Pos.Keys, []string{"one", "two", "twenty-one"}) {
t.Fatalf("unexpected keys: %v", distinct.Pos.Keys)
}
distinct = c.Query(t, "child", `Distinct(index="child", field="parent_set_id")`).Results[0].(pilosa.SignedRow)
if !sameStringSlice(distinct.Pos.Keys, []string{"one", "two", "twenty-one"}) {
t.Fatalf("unexpected keys: %v", distinct.Pos.Keys)
row := c.Query(t, "child", `Distinct(index="child", field="parent_set_id")`).Results[0].(*pilosa.Row)
if !sameStringSlice(row.Keys, []string{"one", "two", "twenty-one"}) {
t.Fatalf("unexpected keys: %v", row.Keys)
}
eq := c.Query(t, "child", `Row(parent_id=="one")`).Results[0].(*pilosa.Row)
@ -6512,7 +6512,6 @@ func TestExecutor_BareDistinct(t *testing.T) {
c.CreateField(t, "i", pilosa.IndexOptions{}, "ints",
pilosa.OptFieldTypeInt(0, math.MaxInt64),
)
c.CreateField(t, "i", pilosa.IndexOptions{}, "set")
c.CreateField(t, "i", pilosa.IndexOptions{}, "filter")
// Populate integer data.
@ -6521,17 +6520,13 @@ func TestExecutor_BareDistinct(t *testing.T) {
Set(%d, ints=2)
`, ShardWidth))
c.Query(t, "i", fmt.Sprintf(`
Set(0, set=1)
Set(1, set=2)
Set(%d, set=2)
Set(0, filter=1)
Set(%d, filter=1)
`, 65537, 65537))
`, 65537))
for _, pql := range []string{
`Distinct(field="ints")`,
`Distinct(index="i", field="ints")`,
`Distinct(Row(filter=1), field="set")`,
} {
exp := []uint64{1, 2}
res := c.Query(t, "i", pql).Results[0].(pilosa.SignedRow)
@ -6890,6 +6885,14 @@ func TestVariousQueries(t *testing.T) {
}
},
},
{
query: "Distinct(Row(affinity<0), field=likes)",
verifier: func(t *testing.T, resp pilosa.QueryResponse) {
if !reflect.DeepEqual(resp.Results[0].(*pilosa.Row).Keys, []string{"pilosa", "zebra", "icecream"}) {
t.Errorf("wrong values: %+v", resp.Results[0])
}
},
},
}
for i, tst := range tests {