mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 00:55:55 +00:00
simplify error messages
also remove test which was accidentally committed
This commit is contained in:
parent
790bea147f
commit
1ed91ebad3
2 changed files with 3 additions and 36 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue