mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-09 12:27:52 +00:00
FieldSum calls fragment.row which needs write lock
remove read lock and call fragment.Row
This commit is contained in:
parent
3aecb61285
commit
f257be9926
1 changed files with 2 additions and 5 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue