@@ -19,30 +19,56 @@ byrow(ds::AbstractDataset, ::typeof(count), col::ColumnIndex; by = isequal(true)
19
19
20
20
# byrow(ds::AbstractDataset, ::typeof(anymissing), cols::MultiColumnIndex = names(ds, Union{Missing, Number})) = row_anymissing(ds, cols)
21
21
22
- function byrow (ds:: AbstractDataset , :: typeof (any), cols:: MultiColumnIndex = :; by = x-> isequal (true , x), threads = nrow (ds)> 1000 )
22
+ function expand_Base_Fix (f, f2)
23
+ if f isa Base. Fix2
24
+ return _bool (x-> f. f (f2 (x), f. x))
25
+ elseif f isa Base. Fix1
26
+ return _bool (x-> f. f (f. x, f2 (x)))
27
+ else
28
+ return x-> f (f2 (x))
29
+ end
30
+ end
31
+
32
+ function byrow (ds:: AbstractDataset , :: typeof (any), cols:: MultiColumnIndex = :; by = isequal (true ), threads = nrow (ds)> 1000 , mapformats = false )
23
33
colsidx = index (ds)[cols]
24
34
if by isa AbstractVector
25
- bys = map (_bool, by)
35
+ if mapformats
36
+ bys = map ((x,y)-> _bool (z-> x (getformat (ds, y)(z))), by, colsidx)
37
+ else
38
+ bys = map (_bool, by)
39
+ end
26
40
threads ? hp_row_any_multi (ds, bys, colsidx) : row_any_multi (ds, bys, colsidx)
27
41
else
28
- bys = repeat ([_bool (by)], length (colsidx))
42
+ if mapformats
43
+ bys = map (y-> _bool (z-> by (getformat (ds, y)(z))), colsidx)
44
+ else
45
+ bys = repeat ([_bool (by)], length (colsidx))
46
+ end
29
47
threads ? hp_row_any_multi (ds, bys, colsidx) : row_any_multi (ds, bys, colsidx)
30
48
end
31
49
end
32
50
33
- byrow (ds:: AbstractDataset , :: typeof (any), col:: ColumnIndex ; by = x -> isequal (true , x ), threads = nrow (ds)> 1000 ) = byrow (ds, any, [col]; by = by, threads = threads)
51
+ byrow (ds:: AbstractDataset , :: typeof (any), col:: ColumnIndex ; by = isequal (true ), threads = nrow (ds)> 1000 , mapformats = false ) = byrow (ds, any, [col]; by = by, threads = threads, mapformats = mapformats )
34
52
35
- function byrow (ds:: AbstractDataset , :: typeof (all), cols:: MultiColumnIndex = :; by = x -> isequal (true , x ), threads = nrow (ds)> 1000 )
53
+ function byrow (ds:: AbstractDataset , :: typeof (all), cols:: MultiColumnIndex = :; by = isequal (true ), threads = nrow (ds)> 1000 , mapformats = false )
36
54
colsidx = index (ds)[cols]
37
55
if by isa AbstractVector
38
- bys = map (_bool, by)
56
+ if mapformats
57
+ bys = map ((x,y)-> expand_Base_Fix (x, getformat (ds, y)), by, colsidx)
58
+ else
59
+ bys = map (_bool, by)
60
+ end
39
61
threads ? hp_row_all_multi (ds, bys, colsidx) : row_all_multi (ds, bys, colsidx)
40
62
else
41
- bys = repeat ([_bool (by)], length (colsidx))
63
+ if mapformats
64
+ bys = map (y-> expand_Base_Fix (by, getformat (ds, y)), colsidx)
65
+ else
66
+ bys = repeat ([_bool (by)], length (colsidx))
67
+ end
42
68
threads ? hp_row_all_multi (ds, bys, colsidx) : row_all_multi (ds, bys, colsidx)
43
69
end
44
70
end
45
- byrow (ds:: AbstractDataset , :: typeof (all), col:: ColumnIndex ; by = x -> isequal (true , x ), threads = nrow (ds)> 1000 ) = byrow (ds, all, [col]; by = by, threads = threads)
71
+ byrow (ds:: AbstractDataset , :: typeof (all), col:: ColumnIndex ; by = isequal (true ), threads = nrow (ds)> 1000 , mapformats = false ) = byrow (ds, all, [col]; by = by, threads = threads, mapformats = mapformats )
46
72
47
73
byrow (ds:: AbstractDataset , :: typeof (isequal), cols:: MultiColumnIndex ; threads = nrow (ds)> 1000 ) = row_isequal (ds, cols, threads = threads)
48
74
byrow (ds:: AbstractDataset , :: typeof (findfirst), cols:: MultiColumnIndex ; by = identity, threads = nrow (ds)> 1000 ) = row_findfirst (ds, by, cols; threads = threads)
0 commit comments