﻿# Apache Arrow: nulls, empty lists and nested training features

Distinguish Arrow validity bitmaps, nested field nulls and empty lists before converting a dataset into model tensors.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/data-guide-arrow-nullable-feature-contract/
Language: en

## A type describes more than a buffer

Arrow defines a typed columnar representation for in-memory data. Its arrays carry a logical type and validity information in addition to value buffers. Reading the stored bytes without the logical interpretation can produce a value where the dataset actually declares a null.

For a supervised dataset, an absent label is different from a label whose numerical value happens to be zero. Replacing both with the same tensor value without a mask can quietly turn unlabeled examples into apparently labeled training records.

## Empty and absent lists are different examples

List-like fields can represent variable numbers of annotations or tokens. An empty list says that the list exists and contains no elements. A null list says that the list value is absent. Individual elements can also have their own validity state.

An illustrative detection dataset might use an empty annotation list for an inspected image with no objects, while a missing list indicates that annotation was not performed. Collapsing those cases changes the supervision. Define their intended meaning before padding or flattening the data.

## Parent and child validity both matter

For a struct array, Arrow's format describes validity at the parent level independently of its children. A child buffer can contain a value at a position where the parent struct is null. That value must not automatically become an observed feature just because it is accessible in a lower-level array.

When extracting nested fields, verify the effective null behavior of the operation used. Inspect examples with a missing parent and examples with a present parent but missing child. They expose different conversion paths that a sample containing only complete records will miss.

## Conversion conventions can change missingness

PyArrow provides explicit types and conversion APIs. Its pandas conversion method documents pandas-specific null semantics. A pipeline moving between Arrow, pandas and tensors therefore needs a declared policy for nulls and floating-point NaN values rather than assuming every interface interprets them identically.

Record the schema before and after conversion, and compare missing-value counts by field. Type inference from a small subset can also miss structures appearing later. Use an explicit schema when the dataset contract is known.

## Test semantic cases before scaling up

A useful conversion fixture includes a valid value, a null scalar, an empty list, a null list, a missing struct and a missing child field. Check resulting values and masks together. These proposed checks verify data meaning; they are not performance measurements of Arrow or a model.

Efficient columnar storage helps move data through a pipeline, but does not decide how missing supervision should affect loss. The training code still needs an explicit rule for exclusion, masking or a separately defined missing category.

## Primary references

[Arrow columnar format](https://arrow.apache.org/docs/format/Columnar.html).

[PyArrow in-memory data model](https://arrow.apache.org/docs/python/data.html).

[PyArrow Array conversion reference](https://arrow.apache.org/docs/python/generated/pyarrow.Array.html).

Related explanations: [Tensor dimensions](/journal/tensor-axes-batch-sequence-hidden/); [Typed document artifacts](/journal/document-markdown-json-provenance/).
