Skip to content

Commit

Permalink
rowenc: de-flake TestEncodeContainingArrayInvertedIndexSpans
Browse files Browse the repository at this point in the history
`TestEncodeContainingArrayInvertedIndexSpans` was failing sporadically
because of randomized test cases that were incorrectly determining the
expected value for the `unique` return value from
`EncodeContainingInvertedIndexSpans`. The test was using the
`reflect.DeepEqual` function to check for `Datum` equality, which does
not return true in all cases where `Datum.Compare` returns `0`.

Fixes #57237

Release note: None
  • Loading branch information
mgartner committed Nov 30, 2020
1 parent 13ce0e8 commit 32b2ea4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/sql/rowenc/index_encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ func TestEncodeContainingArrayInvertedIndexSpans(t *testing.T) {
arr := right.(*tree.DArray).Array
expectUnique := len(arr) > 0
for i := range arr {
if i > 0 && !reflect.DeepEqual(arr[i], arr[0]) {
if i > 0 && arr[i].Compare(&evalCtx, arr[0]) != 0 {
expectUnique = false
break
}
Expand Down

0 comments on commit 32b2ea4

Please sign in to comment.