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

isnull.(x) #180

Open
felipenoris opened this issue Feb 9, 2017 · 4 comments
Open

isnull.(x) #180

felipenoris opened this issue Feb 9, 2017 · 4 comments

Comments

@felipenoris
Copy link

felipenoris commented Feb 9, 2017

Using current master.

using NullableArrays
x = NullableArray{String}(2)
x[1] = "hey"
isnull.(x)

Gives:

2-element NullableArrays.NullableArray{Bool,1}:
 false
 #NULL

I propose to change it, so that the result is [ false, true ] in this case (edit: or NullableArray([false,true]), which I guess is the current behavior of Nullable comparison for now)
Anyone agree with that?

@nalimilan
Copy link
Member

That's been considered, but for now @johnmyleswhite preferred to go with the simpler solution of applying standard lifting semantics to all functions (see #166 (comment), #144). This might change in the future once we have more experience.

Is there any reason why you cannot/don't want to use isnull(x)?

@felipenoris
Copy link
Author

I wanted to use this kind of syntax: x[isnull.(x)].

@nalimilan
Copy link
Member

Mmm, I thought isnull(x::NullableArray) was defined as the vectorized version of isnull, but apparently it isn't (which is consistent with isnull retuning false when the argument isn't a Nullable). So there's no correct way of doing this currently except for x.isnull, which should be discouraged.

I guess we should add a special lift method then.

(Though note that your example doesn't make much sense AFAICT, since it will return a vector of null values...)

@felipenoris
Copy link
Author

felipenoris commented Feb 9, 2017

You´re right... That´s why I considered isnull.(x) returning Array{Bool} instead of nullables.
If that´s the case, I would think that isnull.(lift(x)) should work.
I put up a very simple module with this kind of lift function at https://github.com/felipenoris/Lifting.jl , obviously not the same kind of solution discussed at JuliaLang/julia#18758

update: missing dots

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants