This repository was archived by the owner on May 4, 2019. It is now read-only.
File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,9 @@ eltypes() = Tuple{}
62
62
eltypes (x) = Tuple{eltype (x)}
63
63
eltypes (x, xs... ) = Tuple{eltype (x), eltypes (xs... ). parameters... }
64
64
65
+ hasnulls (x) = isnull (x)
66
+ hasnulls (x, xs... ) = hasnulls (x) | hasnulls (xs... )
67
+
65
68
"""
66
69
broadcast_lift(f, xs...)
67
70
@@ -71,14 +74,10 @@ return `f` applied to values of `xs`.
71
74
"""
72
75
@inline function broadcast_lift (f, xs... )
73
76
if null_safe_op (f, eltypes (xs). parameters... )
74
- # TODO : find a more efficient approach than mapreduce
75
- # (i.e. one which gets lowered to just isnull(x1) | isnull(x2) | ...)
76
- return @compat Nullable (f (unsafe_get .(xs)... ), ! mapreduce (isnull, | , xs))
77
+ return @compat Nullable (f (unsafe_get .(xs)... ), ! hasnulls (xs... ))
77
78
else
78
- U = Core. Inference. return_type (f, eltypes (xs... ))
79
- # TODO : find a more efficient approach than mapreduce
80
- # (i.e. one which gets lowered to just isnull(x1) | isnull(x2) | ...)
81
- if mapreduce (isnull, | , xs)
79
+ U = Core. Inference. return_type (f, eltypes (xs))
80
+ if hasnulls (xs... )
82
81
return Nullable {U} ()
83
82
else
84
83
return Nullable (f (map (unsafe_get, xs)... ))
You can’t perform that action at this time.
0 commit comments