diff --git a/executor_test.go b/executor_test.go index 87af5b276..a20d60495 100644 --- a/executor_test.go +++ b/executor_test.go @@ -6967,40 +6967,6 @@ func TestVariousQueries(t *testing.T) { } } -func TestReproDistinctWFilterIssue(t *testing.T) { - - c := test.MustRunCluster(t, 3) - defer c.Close() - r := rand.New(rand.NewSource(127)) - - for i := 0; i < 77; i++ { - index := fmt.Sprintf("users%d", i) - c.CreateField(t, index, pilosa.IndexOptions{Keys: true, TrackExistence: true}, "likes", pilosa.OptFieldKeys()) - c.CreateField(t, index, pilosa.IndexOptions{Keys: true, TrackExistence: true}, "filterfield", pilosa.OptFieldKeys()) - likes := make([][2]string, 0) - filter := make([][2]string, 0) - for userNum := 0; userNum < 100; userNum++ { - likes = append(likes, [2]string{fmt.Sprintf("like%d", r.Intn(95)), "user" + strconv.Itoa(userNum)}) - if r.Intn(10) < 8 { - filter = append(filter, [2]string{"yes", "user" + strconv.Itoa(userNum)}) - } - } - c.ImportKeyKey(t, index, "likes", likes) - c.ImportKeyKey(t, index, "filterfield", filter) - - distinctRes := c.Query(t, index, "Count(Distinct(Row(filterfield=yes), field=likes))") - distinctCount := distinctRes.Results[0].(uint64) - groupbyRes := c.Query(t, index, "GroupBy(Rows(field=likes), filter=Row(filterfield=yes))") - groupbyCount := uint64(len(groupbyRes.Results[0].([]pilosa.GroupCount))) - - t.Logf("D:%v", distinctRes.Results[0]) - t.Logf("G:%v", groupbyRes.Results[0]) - if distinctCount != groupbyCount { - t.Errorf("distinct: %d, groupby: %d", distinctCount, groupbyCount) - } - } -} - // tableResponseToCSV converts a generic TableResponse to a CSV format // and writes it to the writer. func tableResponseToCSV(m *proto.TableResponse, w io.Writer) error { diff --git a/test/cluster.go b/test/cluster.go index 4fd7372d7..6bdfc8153 100644 --- a/test/cluster.go +++ b/test/cluster.go @@ -61,8 +61,9 @@ func (c *Cluster) Query(t testing.TB, index, query string) pilosa.QueryResponse func (c *Cluster) QueryHTTP(t testing.TB, index, query string) (string, error) { t.Helper() if len(c.Nodes) == 0 { - t.Fatal("must have at least one node in cluster to QueryHTTP") + t.Fatal("must have at least one node in cluster to query") } + return c.Nodes[0].Query(t, index, "", query) } @@ -71,7 +72,7 @@ func (c *Cluster) QueryHTTP(t testing.TB, index, query string) (string, error) { func (c *Cluster) QueryGRPC(t testing.TB, index, query string) *proto.TableResponse { t.Helper() if len(c.Nodes) == 0 { - t.Fatal("must have at least one node in cluster to QueryGRPC") + t.Fatal("must have at least one node in cluster to query") } grpcClient, err := client.NewGRPCClient([]string{fmt.Sprintf("%s:%d", c.Nodes[0].Server.GRPCURI().Host, c.Nodes[0].Server.GRPCURI().Port)}, nil)