Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-15478

[C++] Creating (or casting to) list array with non-nullable field doesn't check nulls

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • C++
    • None

    Description

      When creating a ListArray where you indicate that the values field is not nullable, you can actually create the array with nulls without this is being validated:

      >>> typ = pa.list_(pa.field("element", pa.int64(), nullable=False))
      >>> arr = pa.array([[1, 2], [3, 4, None]], typ)
      >>> arr
      <pyarrow.lib.ListArray object at 0x7f75bdeba760>
      [
        [
          1,
          2
        ],
        [
          3,
          4,
          null
        ]
      ]
      
      >>> arr.type
      ListType(list<element: int64 not null>)
      

      Also explicitly validating it doesn't raise:

      >>> arr.validate(full=True)
      

      Is this something we should check?
      What guarantees do we attach to the nullability of a field of a nested type?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jorisvandenbossche Joris Van den Bossche
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: