Merge pull request #2015 from molecula/union-distinct-ts-better

save space when union-ing DistinctTimestamps
This commit is contained in:
reesporte 2022-04-14 11:11:36 -05:00 committed by GitHub
commit e2bf96731f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1617,12 +1617,12 @@ func (d DistinctTimestamp) ToRows(callback func(*proto.RowResponse) error) error
// Union returns the union of the values of `d` and `other`
func (d *DistinctTimestamp) Union(other DistinctTimestamp) DistinctTimestamp {
both := map[string]string{}
both := map[string]struct{}{}
for _, val := range d.Values {
both[val] = val
both[val] = struct{}{}
}
for _, val := range other.Values {
both[val] = val
both[val] = struct{}{}
}
vals := []string{}
for key := range both {