FieldSum calls fragment.row which needs write lock

remove read lock and call fragment.Row
This commit is contained in:
Matthew Jaffee 2017-09-19 21:37:35 -05:00 • committed by Travis
parent 3aecb61285
commit f257be9926
No known key found for this signature in database
GPG key ID: 7F08008DFD9314C9

View file

@ -545,11 +545,8 @@ func (f *Fragment) SetFieldValue(columnID uint64, bitDepth uint, value uint64) (
// FieldSum returns the sum of a given field as well as the number of columns involved.
// A bitmap can be passed in to optionally filter the computed columns.
func (f *Fragment) FieldSum(filter *Bitmap, bitDepth uint) (sum, count uint64, err error) {
f.mu.RLock()
defer f.mu.RUnlock()
// Compute count based on the existance bit.
row := f.row(uint64(bitDepth), true, true)
row := f.Row(uint64(bitDepth))
if filter != nil {
row = row.Intersect(filter)
}
@ -563,7 +560,7 @@ func (f *Fragment) FieldSum(filter *Bitmap, bitDepth uint) (sum, count uint64, e
// 10*(2^0) + 4*(2^1) + 3*(2^2) = 30
//
for i := uint(0); i < bitDepth; i++ {
row := f.row(uint64(i), true, true)
row := f.Row(uint64(i))
if filter != nil {
row = row.Intersect(filter)
}