Skip to content

RFC: Replace Nullable's isnull field by hasvalue #18507

@nalimilan

Description

@nalimilan

I'd like to suggest changing the isnull::Bool field of Nullable to a hasvalue::Bool field with the opposite meaning. Indeed, all languages and formats I could find use this convention. Following the most common convention is generally a good idea, and it's particularly useful when creating NullableArrays from binary formats like Feather.

Of course, this would be a breaking change, but it would only affect code which does not use the public isnull() method. Since that method is a simple accessor to the eponymous field, there's no reason to access the field directly. Potential breakage would easily be fixed before 0.6 is released by changing x.isnull to isnull(x), which works since Julia 0.4.

Here's a short survey of what other software does in that regard:

  • In C#, the Nullable type has an HasValue field.
  • In Scala, the Option type has an isDefined method.
  • In Go, null types have a Valid field.
  • In SQLite, a NULL is marked via serial type 0 (equivalent to false in most languages).
  • In PostgreSQL, in Feather and in Pandas 2, the null bitmask uses a 0 bit (again equivalent to false in most languages) to denote a null.

CC: @johnmyleswhite @quinnj @davidagold

Metadata

Metadata

Assignees

No one assigned

    Labels

    missing dataBase.missing and related functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions