From 765d28bf9d79a5e9b4949eb7014c0cbe0292ae42 Mon Sep 17 00:00:00 2001 From: Seebs Date: Fri, 23 Oct 2020 16:18:19 -0500 Subject: [PATCH] add test case and bug fix for distinct code The "seenThisRow" value was never getting cleared, which meant that if the first container on a row didn't happen to contain any post-filter bits, the rest of the row wouldn't get evaluated. --- executor.go | 10 +++++++--- executor_test.go | 12 +++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/executor.go b/executor.go index b28d288f1..219246829 100644 --- a/executor.go +++ b/executor.go @@ -1460,10 +1460,14 @@ func executeDistinctShardSet(ctx context.Context, qcx *Qcx, idx *Index, fieldNam for fragData.Next() { k, c := fragData.Value() row := k >> shardVsContainerExponent - if row == prevRow && seenThisRow { - continue + if row == prevRow { + if seenThisRow { + continue + } + } else { + seenThisRow = false + prevRow = row } - prevRow = row if filterBitmap != nil { if roaring.IntersectionAny(c, filter[k%(1<