Merge pull request #297 from seebs/nofreeze

Don't automatically freeze the results of RowSegment ops
This commit is contained in:
seebs 2020-06-03 14:54:12 -05:00 committed by GitHub
commit 33a90fd328
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

40
row.go
View file

@ -574,13 +574,11 @@ func (s *rowSegment) IntersectionCount(other *rowSegment) uint64 {
// Intersect returns the itersection of s and other.
func (s *rowSegment) Intersect(other *rowSegment) *rowSegment {
data := s.data.Intersect(other.data)
data = data.Freeze()
return &rowSegment{
data: data,
shard: s.shard,
n: data.Count(),
writable: true,
data: data,
shard: s.shard,
n: data.Count(),
}
}
@ -591,13 +589,11 @@ func (s *rowSegment) Union(others ...*rowSegment) *rowSegment {
datas[i] = other.data
}
data := s.data.Union(datas...)
data.Freeze()
return &rowSegment{
data: data,
shard: s.shard,
n: data.Count(),
writable: true,
data: data,
shard: s.shard,
n: data.Count(),
}
}
@ -635,26 +631,22 @@ func (s *rowSegment) Difference(others ...*rowSegment) *rowSegment {
datas[i] = other.data
}
data := s.data.Difference(datas...)
data.Freeze()
return &rowSegment{
data: data,
shard: s.shard,
n: data.Count(),
writable: true,
data: data,
shard: s.shard,
n: data.Count(),
}
}
// Xor returns the xor of s and other.
func (s *rowSegment) Xor(other *rowSegment) *rowSegment {
data := s.data.Xor(other.data)
data = data.Freeze()
return &rowSegment{
data: data,
shard: s.shard,
n: data.Count(),
writable: true,
data: data,
shard: s.shard,
n: data.Count(),
}
}
@ -666,13 +658,11 @@ func (s *rowSegment) Shift() (*rowSegment, error) {
if err != nil {
return nil, errors.Wrap(err, "shifting roaring data")
}
data = data.Freeze()
return &rowSegment{
data: data,
shard: s.shard,
n: data.Count(),
writable: true,
data: data,
shard: s.shard,
n: data.Count(),
}, nil
}