Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Reading a spreadsheet by columns
If you store a table line by line, like a diary, then to find the average temperature you must read every line, including all the other measurements on it. If you store it column by column, all the temperatures sit together: you read just that column, and because similar numbers sit next to each other, it also shrinks better when compressed. That is the idea behind columnar formats like Parquet.
Spacecraft housekeeping telemetry, sensor logs from test campaigns and astronomical catalogues are long, wide tables queried a few columns at a time. Moving them from CSV to Parquet often cuts storage several times and speeds queries by orders of magnitude, while keeping types and units explicit.
- 1. A columnar file stores…
- 2. Why does a column compress well?
- 3. In the demo, how much does a row layout read for a two-column query?
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.Formats at a glance
| Format | Layout | Types | Compression | Partial reads |
|---|---|---|---|---|
| CSV | text rows | none (strings) | external (gzip) | no |
| JSON Lines | text rows | loose | external | no |
| Parquet | columnar, row groups | yes (logical types) | per column (Snappy, Zstd, gzip) | columns + row groups |
| Arrow IPC / Feather | columnar, in-memory layout | yes | optional (LZ4, Zstd) | columns, memory-mapped |
| HDF5 / NetCDF / Zarr | chunked arrays | yes | per chunk | slices (C7.2) |
import pandas as pd
df = pd.read_csv("telemetry.csv", dtype={"sat_id": "string"}, parse_dates=["time"])
df.to_parquet("telemetry.parquet", engine="pyarrow", compression="zstd", row_group_size=100_000)
cols = pd.read_parquet("telemetry.parquet", columns=["time", "temp"],
filters=[("time", ">=", pd.Timestamp("2024-03-01"))])DuckDB and Polars query Parquet files directly (SELECT avg(temp) FROM 'telemetry/*.parquet' WHERE ...) without loading them.
- 1. Which format preserves column types?
- 2. read_parquet(columns=[...]) reads…
- 3. Arrow is mainly…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 35 minUndergraduate students and practising engineers.CSV pitfalls
Types are guessed: IDs lose leading zeros (“007” → 7), dates are ambiguous (01/02/2024), missing values come as “”, “NA” or “-999”, floats lose precision when printed with few digits or bloat when printed with 17, and commas or quotes inside fields need correct quoting. Always pass explicit dtypes and NA values, and prefer a typed format for anything beyond small exchanges.
Inside Parquet
A file is a sequence of row groups (typically 64 MB–1 GB); within each, every column chunk is stored contiguously, split into pages. Each column is first encoded (dictionary encoding for low-cardinality values, run-length/bit-packing for repeated values, delta encoding for sorted integers like timestamps) and then compressed. The footer holds the schema and per-chunk statistics (min, max, null count), letting readers skip row groups that cannot match a filter (predicate pushdown). Sorting data by a commonly filtered column makes statistics more selective and runs longer.
Arrow
A column is a set of contiguous buffers: a validity bitmap (1 bit per value), fixed-width values, or for variable-length types an offsets buffer (n + 1 int32/int64) plus one data buffer. pandas, Polars, DuckDB, Spark and GPU libraries exchange Arrow data without copying.
- 1. Which encoding suits a column of mostly repeated status codes?
- 2. Predicate pushdown uses…
- 3. Arrow offsets for strings 'sat', null, 'orbit'?
Level 3: Advanced
★★★★☆ Advanced⏱ 30 minGraduate level, with full derivations and proofs.Designing tables for analysis
- Partition large datasets into many Parquet files by a coarse key (date, satellite, campaign):
telemetry/sat=7/date=2024-03-01/part-0.parquet; engines prune whole directories. - Sort within files by the main filter key for tight statistics and long runs.
- Store at the right precision: a temperature measured to 0.01 °C does not need 17 significant digits; scaled integers or float32 compress far better.
- Units and metadata: keep units, frames and provenance in the schema metadata or a data dictionary, not in column names alone.
- Avoid many tiny files (C4.1): aim for files of hundreds of MB.
- 1. Partitioning by date lets a query for one day…
- 2. Sorting a file by time improves…
- 3. Why store sensor readings at sensor precision?
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.Tabular formats, measured
Exercise 1. Naive inference turns “007” into 7; the csv module round-trips commas and quotes but returns numbers as strings. Arrow stores “sat”, null, “orbit” as bitmap 0b101, offsets 0, 3, 3, 8 and 8 data bytes. Dictionary + RLE turn OK, OK, SAFE, OK, OK, OK into three runs; 1000 timestamps at a 10 s cadence delta-encode to a single repeated value. A 10 000-row, 4-column columnar file answers “temp where 2500 ≤ time ≤ 3499” by reading 17.8 kB of its 162 kB (11%): two row groups, two columns.
Exercise 2: six layouts for 100 000 telemetry rows (1 s timestamps, drifting temperature, noisy voltage, rarely changing mode and satellite id; zlib level 6; 10 000-row groups):
| Layout | Size | vs CSV |
|---|---|---|
| CSV | 5.22 MB | 1× |
| CSV + zlib | 1.93 MB | 2.7× |
| binary rows + zlib | 1.68 MB | 3.1× |
| columnar, uncompressed | 2.60 MB | 2.0× |
| columnar + zlib | 1.51 MB | 3.5× |
| columnar + delta/RLE encodings + zlib | 1.36 MB | 3.8× |
| columnar, sensor-precision integers + encodings + zlib | 0.21 MB | 24.8× |
Per column in the encoded file: time 1.4 kB, mode 0.4 kB, satellite 0.2 kB, while temperature and voltage take 674 and 686 kB: full-precision floats carry noise digits that no compressor removes, so storing values at their measurement resolution is the largest single gain. A query for the mean temperature over the first 10% of time reads 68 kB from the columnar file versus 5.2 MB of CSV (77×) or 1.7 MB of compressed binary rows. (Compressed sizes can differ slightly between zlib builds.)
Tabular formats in AI, robotics and aerospace
- Housekeeping telemetry archives in Parquet partitioned by spacecraft and day, queried with DuckDB or Spark.
- Astronomical catalogues (Gaia, LSST) distributed as Parquet/HATS for column-oriented queries.
- ML feature stores and experiment logs built on Parquet and Arrow.
- Robotics logs: ROS bag data converted to columnar tables for analysis (MCAP exports).
References
- Apache Parquet documentation (parquet.apache.org): file format, encodings, statistics.
- Apache Arrow documentation (arrow.apache.org): columnar format specification.
- D. Abadi, S. Madden, N. Hachem (2008). “Column-stores vs. row-stores: how different are they really?” SIGMOD.
- M. Raasveldt, H. Mühleisen (2019). “DuckDB: an embeddable analytical database.” SIGMOD (demo).
- RFC 4180 (2005). Common Format and MIME Type for Comma-Separated Values (CSV) Files.