Missing and Empty Fields in Delimited Rows
An empty field occupies a position. A missing field changes the number of fields available to a reader.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace two row spellings
The row A,,7 contains three fields, including an empty middle one. The row A,7 contains two. A typed reader can reject the second under a three-column contract. Missing, empty, and zero values explain why an empty field needs its own domain policy.
Decide after parsing
Some datasets treat the empty field as absent and others as valid text. A validation stage can apply that choice after the CSV dialect has recovered the three individual positions.[1]
Read the expected number of fields before converting values
With three headings, 17,,north has an empty second field and three field positions. The row 17,north has two fields and may be structurally incomplete. Filling missing fields by reading from an assumed trailing position can shift meaning. See absence and empty values.
Expected names: id, label, region
17,,north → ["17", "", "north"]
17,north → ["17", "north"]
Structural check detects length 2
Move semantic null rules above the CSV layer
A format can use a reserved marker for known null or interpret an empty field as absent under a schema. Ordinary CSV syntax alone does not specify that meaning. Test empty last fields, quoted empty text and shorter rows.