Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Commit

Permalink
unsafe AbstractNullableArray fallbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
alyst committed Oct 4, 2016
1 parent 38c477c commit 40fdfc0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,23 @@ end

# test if the value X[i] is null without checking the `I` index validity
unsafe_isnull(X::NullableArray, I::Int...) = Base.unsafe_getindex(X.isnull, I...)
unsafe_isnull{T}(X::AbstractNullableArray{T}, I::Int...) = isnull(Base.unsafe_getindex(X, I...))

# returns non-null element of X wrapped in Nullable
function unsafe_getindex_notnull(X::NullableArray, I::Int...)
return Nullable(Base.unsafe_getindex(X.values, I...))
end
function unsafe_getindex_notnull{T}(X::AbstractNullableArray{T}, I::Int...)
return Base.unsafe_getindex(X, I...)
end

# return non-null element of X
function unsafe_getvalue_notnull(X::NullableArray, I::Int...)
return Base.unsafe_getindex(X.values, I...)
end
function unsafe_getvalue_notnull{T}(X::AbstractNullableArray{T}, I::Int...)
return get(Base.unsafe_getindex(X, I...))
end

if VERSION >= v"0.5.0-dev+4697"
function Base.checkindex(::Type{Bool}, inds::AbstractUnitRange, i::Nullable)
Expand Down

0 comments on commit 40fdfc0

Please sign in to comment.