diff --git a/executor.go b/executor.go index 4a0fa5d27..39bfa30f8 100644 --- a/executor.go +++ b/executor.go @@ -361,7 +361,7 @@ func (e *executor) readColumnAttrSets(index *Index, ids []uint64) ([]*ColumnAttr } // handlePreCalls traverses the call tree looking for calls that need -// precomputed values (e.g. Distinct, UnionRows, ConstRow...) +// precomputed values (e.g. Distinct, UnionRows, ConstRow...). func (e *executor) handlePreCalls(ctx context.Context, qcx *Qcx, index string, c *pql.Call, shards []uint64, opt *execOptions) error { if c.Name == "Precomputed" { idx := c.Args["valueidx"].(int64) @@ -4264,8 +4264,8 @@ func (e *executor) executeCount(ctx context.Context, qcx *Qcx, index string, c * child := c.Children[0] - // if the child is precomputed, we'll bypass mapreduce, ignore - // shards, and just count the number of bits + // If the child is precomputed, we'll bypass mapreduce, ignore + // shards, and just count the number of bits. if child.Name == "Precomputed" { count := uint64(0) for _, irow := range child.Precomputed { @@ -6056,7 +6056,7 @@ func (e *executor) howToTranslate(idx *Index, row *Row) (rowIdx *Index, rowField } } - // Handle the case where the Row has specified a field + // Handle the case where the Row has specified a field. if rowField != nil { // Handle case where field has a foreign index. if rowField.ForeignIndex() != "" { @@ -6073,7 +6073,8 @@ func (e *executor) howToTranslate(idx *Index, row *Row) (rowIdx *Index, rowField return rowIdx, rowField, noTranslation, nil } - // In this case, the row has specified an index, but not a field, so we translate according to that index. + // In this case, the row has specified an index, but not a field, + // so we translate according to that index. if rowIdx != idx && rowIdx.Keys() { return rowIdx, rowField, byRowIndex, nil } diff --git a/executor_test.go b/executor_test.go index 5d79298ab..89b25ea40 100644 --- a/executor_test.go +++ b/executor_test.go @@ -6743,7 +6743,17 @@ func TestMissingKeyRegression(t *testing.T) { } } -func TestDistinctOnSetsKeyedIndex(t *testing.T) { +// TestVariousQueries has originally been written to test out a +// variety of scenarios with Distinct, but it's structure is more +// general purpose. My vision is to eventually have any test which +// needs to test a single query be in here, and have a robust enough +// test data set loaded at the start which covers what we want to +// test. +// +// I'd also like to have it automatically run a matrix of scenarios +// (single and multi-node clusters, different endpoints for the +// queries (HTTP, GRPC, Postgres), etc.). +func TestVariousQueries(t *testing.T) { c := test.MustRunCluster(t, 3) defer c.Close() @@ -6858,11 +6868,12 @@ func TestDistinctOnSetsKeyedIndex(t *testing.T) { }, }, - // handling this case properly will require changing the way + // Handling this case properly will require changing the way // that precomputed data is stored on Call objects. Currently // if a Distinct is at all nested (e.g. within a Count) it // gets handled by executor.handlePreCalls which assumes that // only the positive values are worthwhile. + // // { // query: "Count(Distinct(field=affinity))", // verifier: func(t *testing.T, resp pilosa.QueryResponse) {