-
Notifications
You must be signed in to change notification settings - Fork 30
/
filters.go
47 lines (40 loc) · 949 Bytes
/
filters.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package fcolumn
import (
"math"
"github.com/tobgu/qframe/filter"
"github.com/tobgu/qframe/internal/index"
)
var filterFuncs0 = map[string]func(index.Int, []float64, index.Bool){
filter.IsNull: isNull,
filter.IsNotNull: isNotNull,
}
var filterFuncs1 = map[string]func(index.Int, []float64, float64, index.Bool){
filter.Gt: gt,
filter.Gte: gte,
filter.Lt: lt,
filter.Lte: lte,
filter.Eq: eq,
filter.Neq: neq,
}
var filterFuncs2 = map[string]func(index.Int, []float64, []float64, index.Bool){
filter.Gt: gt2,
filter.Gte: gte2,
filter.Lt: lt2,
filter.Lte: lte2,
filter.Eq: eq2,
filter.Neq: neq2,
}
func isNull(index index.Int, column []float64, bIndex index.Bool) {
for i, x := range bIndex {
if !x {
bIndex[i] = math.IsNaN(column[index[i]])
}
}
}
func isNotNull(index index.Int, column []float64, bIndex index.Bool) {
for i, x := range bIndex {
if !x {
bIndex[i] = !math.IsNaN(column[index[i]])
}
}
}