Labs › storage

Build Your Own Columnar Storage (Parquet-lite)

Build columnar storage from in-memory column scans to row groups with dictionary encoding to RLE bit-packing with a binary file format — understanding why Parquet reads 9x faster than row stores for analytics.

rust 1.83 advanced ~12h build · ~3h read ~850 LoC (v3)
v0: Column-Oriented In-Memory Storev1: Row Groups + Dictionary Encodingv2: RLE + Bit-Packing + File Format
☕ Java/Spring integration included service client

Why this lab exists

Every analytics database you use — BigQuery, Snowflake, Redshift, DuckDB — stores its tables in a columnar format. When you run SELECT SUM(price) FROM orders, the database reads only the price column bytes. A row-oriented database like PostgreSQL reads every column in every row just to extract price. For a table with 8 columns and 100 million rows, that is an 8x difference in I/O before any work is done.

Apache Parquet is the de facto columnar file format for the data ecosystem: Spark, Hive, Arrow, Pandas, and DuckDB all read and write Parquet. Yet most engineers who use Parquet daily have never looked at how column projection, row group pruning, or dictionary encoding actually work at the byte level.

This lab changes that. You will build a Parquet-lite engine in three stages: from an in-memory column store that proves the cache efficiency claim, to row groups with dictionary encoding and predicate pushdown, to RLE and bit-packing with a binary file format that mirrors Parquet’s footer-first design. By the end, every Parquet optimization you read about in a query optimizer blog post will be something you have implemented yourself.

What we are building

A columnar storage engine where:

  • The fundamental unit is a column: a Vec<Value> array, one element per row
  • Value is a typed enum: Int(i64), Float(f64), Str(String), Bool(bool), Null
  • Rows are decomposed into per-column appends on write; column arrays are scanned directly on read
  • Row groups batch rows into fixed-size blocks (65,536 rows) with per-column min/max statistics
  • Dictionary encoding compresses low-cardinality string columns to 1-byte codes
  • RLE compresses sorted columns; bit-packing compresses small integers
  • A binary file format (magic + row groups + footer offset table) provides persistence

Explicit scope exclusions: no Snappy/Zstd compression, no Bloom filters, no nested types (lists/structs), no schema evolution, no SIMD vectorization, no S3 byte-range reads, no concurrent readers.

Mental model

Row store vs column store: a cache line story

The performance difference between row and column stores is not about algorithms — it is about cache lines.

A modern CPU cache line is 64 bytes. When the CPU loads a memory address, it loads the entire 64-byte cache line containing that address. Cache efficiency means: what fraction of the loaded bytes do we actually use?

Consider a table with 8 columns of 8 bytes each. One row = 64 bytes = exactly one cache line.

Row store — one row per cache line:
  Cache line: [id:8][price:8][qty:8][status:8][region:8][ts:8][discount:8][active:8]
  SUM(price): load cache line, use 8 bytes, discard 56 bytes
  Cache efficiency: 8/64 = 12.5%

Column store — one column chunk per cache line:
  Cache line: [price:8][price:8][price:8][price:8][price:8][price:8][price:8][price:8]
  SUM(price): load cache line, use all 64 bytes (8 prices)
  Cache efficiency: 64/64 = 100%

This is not a theoretical difference. Modern CPUs process memory at 40-100 GB/s when they hit L3 cache, but drop to 10-20 GB/s on cache misses. A column store that scans a contiguous Vec<i64> runs at near-peak memory bandwidth; a row store that scans the same 1M integers is scattered across 8M cache line loads.

Row groups: the unit of parallelism and pruning

A row group is a horizontal partition of the table — a fixed number of consecutive rows stored together. Parquet’s default is 128K rows per group; we use 65,536.

Table: 1,000,000 rows
  Row group 0:  rows 0..65535      (Jan data)  min_ts=1700000000 max_ts=1700065535
  Row group 1:  rows 65536..131071 (Feb data)  min_ts=1700065536 max_ts=1700131071
  ...
  Row group 15: rows 983040..999999             min_ts=1701310464 max_ts=1701375999

Query: WHERE ts > 1701310000
  Row groups 0-14: max_ts < 1701310000 — skip entirely (0 bytes read)
  Row group 15: may contain matching rows — read and filter

The min/max statistics live in the file footer (and in our ColumnStats struct). Skipping a row group is free — it requires only reading 16 bytes of metadata, not any column data. For a query that touches 1% of rows, 99% of row groups are skipped.

Dictionary encoding: turn strings into integers

A status column with values “active”, “inactive”, “pending”, “suspended”, “trial” has 5 distinct values but 1 million rows. Dictionary encoding stores each unique value once (the dictionary) and stores one 1-byte code per row.

Without dictionary (1M rows, avg 8 bytes/value):
  Raw storage: 1,000,000 * 8 = 8 MB

With dictionary (5 distinct values + 1 byte/row):
  Dictionary: 5 values * 8 bytes = 40 bytes
  Codes:      1,000,000 * 1 byte = 1 MB
  Total:      ~1 MB  (87.5% reduction)

On top of dictionary encoding, Parquet applies RLE (run-length encoding) to the code stream — if rows are sorted by status, consecutive codes are identical and compress further. Our implementation applies these encodings independently.

Prerequisites

Complete the WAL lab first to understand binary file formats (magic bytes, length-prefixed records, footer offsets). The v2 file format in this lab uses the same design patterns. Familiarity with Rust’s std::collections::HashMap and Vec is assumed throughout.

Stage-by-stage build

Stage 0 Column-Oriented In-Memory Store ~200 LoC ›
  • Define Value enum: Int(i64), Float(f64), Str(String), Bool(bool), Null
  • Define ColumnStore: columns map (col_name to ColumnData) + num_rows
  • Implement append_row: decompose row map into per-column pushes; fill missing with Null
  • Implement scan_column: O(1) access to a full column slice
  • Implement select: project columns, optional Predicate filter
  • Define Predicate: Eq(col, val), Lt(col, val), And(Predicate, Predicate)
  • Build RowStore baseline: Vec of row maps with sum_int_column for comparison
  • Write 8 tests covering all operations and edge cases

The key design decision in v0 is the data layout. A RowStore stores Vec<HashMap<String, Value>> — each element is a full row. A ColumnStore stores HashMap<String, Vec<Value>> — each entry is a full column. Flipping the nesting order is the entire columnar idea.

pub struct ColumnStore {
    pub columns: HashMap<String, ColumnData>,  // col_name -> Vec<Value>
    pub num_rows: usize,
}

The append operation decomposes a row into per-column pushes. Missing columns receive Value::Null — this ensures all columns stay the same length after every append, which is required for the row index to work:

pub fn append_row(&mut self, row: HashMap<String, Value>) {
    for (col_name, col_data) in &mut self.columns {
        let val = row.get(col_name).cloned().unwrap_or(Value::Null);
        col_data.push(val);
    }
    self.num_rows += 1;
}

The scan operation is O(1) — it returns a &[Value] slice directly from the Vec:

pub fn scan_column(&self, name: &str) -> Option<&[Value]> {
    self.columns.get(name).map(|c| c.as_slice())
}

No deserialization, no row reconstruction, no pointer chasing. The entire column is a contiguous array in memory. The CPU prefetcher can stream it at full memory bandwidth.

The benchmark target is sum_int_column. The column store implementation:

pub fn sum_int_column(&self, name: &str) -> Option<i64> {
    self.scan_column(name).map(|col| {
        col.iter().filter_map(|v| v.as_int()).sum()
    })
}

This iterates one Vec<Value> of length 1M. The row store implementation iterates Vec<HashMap<String, Value>> of length 1M, extracting one field from each map. The map lookup is O(1) but requires hashing and pointer following — exactly the cache inefficiency the column layout avoids.

Predicate evaluation in v0 iterates row-by-row within the column. This is not ideal — better implementations vectorize the predicate over the column array. But v0 demonstrates the correctness of column-level evaluation:

fn eval_predicate(&self, pred: &Predicate, row_idx: usize) -> bool {
    match pred {
        Predicate::Eq(col, expected) => {
            let actual = self.columns.get(col)
                .and_then(|c| c.get(row_idx));
            actual == Some(expected)
        }
        // ...
    }
}

The And combinator is recursive — it supports arbitrarily deep predicate trees with the same evaluation loop.

Stage 1 Row Groups + Dictionary Encoding ~350 LoC ›
  • Define RowGroup: columns map + ColumnStats per column + size
  • ColumnStats: min_int, max_int, null_count, distinct_count
  • ColumnStats::can_satisfy(pred): return false if row group cannot match predicate
  • ParquetLiteWriter: accumulates rows, flushes RowGroup at ROW_GROUP_SIZE
  • ParquetLiteReader::scan: skip row groups via may_satisfy, then row-level filter
  • DictColumn: dict (Vec of Value) + codes (Vec of u8 — one code per row)
  • encode_dict: build dictionary, return None if distinct/total >= 0.5 or more than 256 values
  • decode_dict: expand codes back to ColumnData
  • Write 5 tests: group splits, dict correctness, dict round-trip, pruning, null_count

v1 introduces two independent features that interact: row groups give us the unit of pruning, and dictionary encoding compresses the column data within each group.

Row group structure — a RowGroup holds one column per key, plus computed stats:

pub struct RowGroup {
    pub columns: HashMap<String, ColumnData>,
    pub stats: HashMap<String, ColumnStats>,
    pub size: usize,
}

pub struct ColumnStats {
    pub min_int: Option<i64>,
    pub max_int: Option<i64>,
    pub null_count: usize,
    pub distinct_count: usize,
}

The stats are computed once when the row group is finalised (finalise_stats). After finalisation, no row-level data is needed to answer “can this group match predicate P?” — only the stats are consulted.

Row group pruning — the can_satisfy method:

pub fn can_satisfy(&self, pred: &Predicate) -> bool {
    match pred {
        Predicate::Eq(_, Value::Int(target)) => {
            match (self.min_int, self.max_int) {
                (Some(lo), Some(hi)) => *target >= lo && *target <= hi,
                _ => true,
            }
        }
        Predicate::Lt(_, Value::Int(threshold)) => {
            self.min_int.map_or(true, |min| min < *threshold)
        }
        _ => true, // conservative: don't prune unknown predicates
    }
}

If can_satisfy returns false, the entire row group is skipped — no column data is read. This is the key Parquet optimization: for a query touching 1% of rows, 99% of row groups are skipped in O(1) per group.

The writer buffers rows and flushes when the group fills:

pub fn write_row(&mut self, row: HashMap<String, Value>) {
    // append to current group...
    self.current_group.size += 1;
    if self.current_group.size >= ROW_GROUP_SIZE {
        self.flush_group();
    }
}

When flush_group is called, finalise_stats is computed over the completed group before it is moved to finished_groups. The new current group is empty.

Dictionary encoding — the encoding decision is per-column per-row-group. If a column has fewer than 256 distinct values and distinct_count / total_count < 0.5, we encode it:

pub fn encode_dict(col: &ColumnData) -> Option<DictColumn> {
    let mut dict: Vec<Value> = Vec::new();
    let mut index_map: HashMap<String, u8> = HashMap::new();
    let mut codes: Vec<u8> = Vec::with_capacity(col.len());

    for v in col {
        let key = value_key(v);
        let code = if let Some(&existing) = index_map.get(&key) {
            existing
        } else {
            if dict.len() >= 256 { return None; }
            let code = dict.len() as u8;
            dict.push(v.clone());
            index_map.insert(key, code);
            code
        };
        codes.push(code);
    }
    // only encode if worthwhile
    let ratio = dict.len() as f64 / col.len().max(1) as f64;
    if ratio >= 0.5 { return None; }
    Some(DictColumn { dict, codes })
}

A status column with 5 values and 1M rows: dict has 5 entries (~40 bytes total), codes has 1M entries (1 byte each = 1 MB). Raw storage of 1M strings would be 8-12 MB. Compression: ~99%.

Decoding is a simple code-to-value lookup:

pub fn decode_dict(dict_col: &DictColumn) -> ColumnData {
    dict_col.codes.iter().map(|&code| {
        dict_col.dict.get(code as usize).cloned().unwrap_or(Value::Null)
    }).collect()
}

This is also vectorisable — the code-to-value lookup is a table lookup, which CPUs handle efficiently via gather instructions.

Stage 2 RLE + Bit-Packing + File Format ~300 LoC ›
  • RleColumn: Vec of (Value, u32) run pairs + total_rows
  • encode_rle: scan column, merge consecutive equal values into runs
  • decode_rle: expand runs back to flat Vec of Value
  • bits_needed(max_val): minimum bits to represent a non-negative integer
  • bitpack(values, bits): pack N bits per value into a byte slice
  • bitunpack(packed, bits, len): unpack byte slice back to Vec of i64
  • write_file: magic + row groups (col_name+enc_type+data) + footer offset table
  • read_file: verify magic, seek to footer, read group offsets, reconstruct RowGroups
  • Write 5 tests: RLE ratio, bit-pack ratio, file round-trip, footer offsets, mixed types

v2 adds two more encoding schemes and a binary file format. The encodings are complementary: dictionary encoding helps low-cardinality columns, RLE helps sorted columns, and bit-packing helps integer columns with a small range.

Run-length encoding merges consecutive equal values into (value, count) pairs:

pub fn encode_rle(col: &[Value]) -> RleColumn {
    let mut runs: Vec<(Value, u32)> = Vec::new();
    for val in col {
        match runs.last_mut() {
            Some((last_val, count)) if last_val == val => { *count += 1; }
            _ => { runs.push((val.clone(), 1)); }
        }
    }
    RleColumn { runs, total_rows: col.len() }
}

A timestamp column sorted by hour: if there are 200 rows per hour and 5,000 hours, the encoded form has 5,000 run pairs instead of 1M values — a 200x reduction. At 16 bytes per run pair (8 for value + 4 for count + overhead), that is 80 KB vs 8 MB.

Bit-packing addresses integer columns where values fit in fewer than 64 bits. A column of small integers (0-255) wastes 56 of 64 bits per value in a Vec<i64>. Bit-packing stores each value in the minimum number of bits:

pub fn bitpack(values: &[i64], bits: u8) -> Vec<u8> {
    let total_bits = values.len() * bits as usize;
    let byte_count = (total_bits + 7) / 8;
    let mut output = vec![0u8; byte_count];
    let mut bit_pos = 0usize;
    for &v in values {
        for bit_idx in (0..bits).rev() {
            let bit = ((v >> bit_idx) & 1) as u8;
            let byte_idx = bit_pos / 8;
            let bit_within_byte = 7 - (bit_pos % 8);
            output[byte_idx] |= bit << bit_within_byte;
            bit_pos += 1;
        }
    }
    output
}

For 8-bit packing: 1M integers × 8 bits = 1M bytes. Raw: 1M × 8 bytes = 8 MB. That is 8x compression from bit-packing alone, before any other encoding.

The file format — Parquet’s key design is footer-last: the file begins with raw data, and the footer (offset table) is at the end. To open a Parquet file, you seek to the last 8 bytes (the footer offset), then seek to the footer and read the offset table, then issue targeted byte-range reads for the columns you need.

File structure:
  MAGIC (8 bytes)
  ROW GROUP 0
    num_cols (u32 LE)
    row_count (u32 LE)
    for each column:
      name_len (u16 LE)
      name_bytes (UTF-8)
      encoding_type (u8)
      data_len (u32 LE)
      data_bytes
  ROW GROUP 1
    ...
  FOOTER
    num_groups (u32 LE)
    group_0_offset (u64 LE)
    group_1_offset (u64 LE)
    ...
    footer_offset (u64 LE)   <- last 8 bytes of file

The footer offset at the very end is the anchor: read_file seeks to file_end - 8, reads the footer offset, then seeks to the footer and reads all group offsets. This enables reading a specific row group without scanning the file sequentially.

pub fn read_file<R: Read + Seek>(reader: &mut R) -> io::Result<Vec<RowGroup>> {
    // Verify magic
    let mut magic = [0u8; 8];
    reader.read_exact(&mut magic)?;
    if &magic != MAGIC { return Err(...); }

    // Read footer offset from last 8 bytes
    reader.seek(SeekFrom::End(-8))?;
    let mut footer_offset_buf = [0u8; 8];
    reader.read_exact(&mut footer_offset_buf)?;
    let footer_offset = u64::from_le_bytes(footer_offset_buf);

    // Seek to footer and read group offsets
    reader.seek(SeekFrom::Start(footer_offset))?;
    // ...
}

This is identical in design to Apache Parquet’s actual read path — the only difference is that Parquet stores many more fields per column chunk (encoding metadata, dictionary page, data pages, statistics, Bloom filter offset, etc.).

Run it yourself

Prereqs: Rust 1.83+cargo
  1. 1
    Clone and build
    git clone https://github.com/pushkarkumar-dev/system-design-labs
    cd system-design-labs/labs/columnar-storage
    cargo build
  2. 2
    Run all tests (18 tests across v0, v1, v2)
    cargo test
  3. 3
    Run the demo (1M rows, column vs row scan comparison)
    cargo run --bin columnar-demo
  4. 4
    Run benchmarks (generates HTML in target/criterion/)
    cargo bench
  5. 5
    Run the Java integration demo
    cd java-integration
    mvn spring-boot:run
Expected output
=== Columnar Storage Demo — 1000000 rows ===

Building column store...
Built 1000000 rows in both stores.

Column store SUM(price): 4999950000000
Time: ~2ms

Row store SUM(price): 4999950000000
Time: ~18ms

Column store is ~9.0x faster for this scan.

--- Dictionary Encoding ---
Status column (5 distinct values):
Raw size (approx):  8000000 bytes
Dict encoded size:  1000040 bytes
Compression ratio:  8.0x

--- Row Groups + File Format ---
Wrote 1000 rows -> 1 row group(s)
File size: ~14000 bytes, 1 row group offset(s) in footer
Recovered 1 row group(s) from file

=== Demo complete ===

Benchmarks

Benchmark results on M2 MacBook Pro, 16GB RAM
Metric Result Notes
Column scan (1M rows, sum int column) 2.8 GB/s estimated — contiguous i64 array, CPU vectorized
Row scan (1M rows, sum int column) 0.3 GB/s estimated — 9x cache miss overhead
Dict encoding (status column, 5 values, 1M rows) 99.6 % size reduction estimated — u8 codes vs 12-byte avg string
RLE compression (sorted timestamp, 1M rows) 95 % size reduction estimated — sorted int, avg run length 200
Row group predicate pushdown (1% selectivity) 99 % row groups skipped estimated — min/max stats eliminate 99% of groups

These numbers are estimates based on theoretical cache efficiency analysis and the M2’s memory bandwidth (100 GB/s peak). Run cargo bench for numbers from your specific hardware. The column-vs-row gap grows wider on machines with slower memory (DDR4 vs LPDDR5) and narrows on machines with larger L3 caches that can hold the entire row.

Stress tests

To verify correctness under load, the test suite includes:

Column-row equivalence: build 1M rows in both ColumnStore and RowStore, verify that sum_int_column returns identical results. If the column decomposition loses any values, this fails.

Row group split boundary: write exactly ROW_GROUP_SIZE + 1 rows to a ParquetLiteWriter, verify that finish() returns exactly 2 groups — the first with ROW_GROUP_SIZE rows and the second with 1. Tests the off-by-one in the flush trigger.

Dictionary round-trip with all Value types: encode and decode a column containing Int, Float, Str, Bool, and Null values. Verifies that the value_key function produces unique keys for all types.

Predicate pushdown skips exactly the right groups: build 3 row groups with non-overlapping integer ranges, query for a value in only the first group, verify that count_skipped returns 2.

File format round-trip with mixed types: write a file containing Int, Float, Str, Bool, and Null values, read it back, verify byte-for-byte equality of all column data.

What the toy misses

What the toy misses Honest gaps vs. production
  • Snappy/Zstd block compression Parquet applies Snappy or Zstd compression on top of encoding. A Zstd-compressed dictionary-encoded column achieves 50-100x compression vs raw row storage. Our encoding layer does not apply general-purpose compression.
  • Bloom filter per column per row group Parquet can store Bloom filters to answer 'is this value in the row group?' in O(1). Without a Bloom filter, equality predicates require reading the min/max stats and potentially the full column data.
  • Vectorized execution (SIMD) DuckDB reads columnar data with AVX-512 SIMD — processing 8 int64 values per instruction. Our Rust loop is scalar. Vectorized sum over 1M int64 values runs in ~0.3ms vs ~1ms scalar.
  • Nested types (lists, structs, maps) Parquet supports nested data via Dremel encoding (definition level + repetition level). Encoding a column of variable-length lists requires two extra integer arrays per value — our Value enum handles only flat types.
  • Schema evolution Adding a column to Parquet requires only writing new row groups with the new column — old row groups are read with nulls for missing columns. Schema evolution requires careful management of column IDs vs names.
  • S3 remote reads with byte-range Parquet's footer-first design enables reading column chunks from S3 with HTTP byte-range requests — no full file download. Our file format uses the same footer design but only reads from local disk.

Wiring it into a Java/Spring service

☕

Wiring it into a Java/Spring service

service client Spring Boot 3.3
Maven dependencies
org.apache.parquet:parquet-avro:1.14.1
org.apache.hadoop:hadoop-common:3.4.0
org.springframework.boot:spring-boot-starter-web:3.3.0

Part A — ColumnarClient: HTTP bridge to the Rust engine

ColumnarClient.java wraps the Rust columnar server’s REST endpoints using Spring Framework 6.1’s RestClient. The key operation is column-level aggregation — the Rust server returns only the aggregate, not the raw column data:

public class ColumnarClient {
    private final RestClient http;

    public ColumnarClient(String baseUrl) {
        this.http = RestClient.builder()
                .baseUrl(baseUrl)
                .defaultHeader("Accept", "application/json")
                .build();
    }

    /** Sum an integer column. The Rust server does the scan; Java receives the aggregate. */
    public long sumColumn(String columnName) {
        var resp = http.get()
                .uri("/sum?col={col}", columnName)
                .retrieve()
                .body(SumResponse.class);
        return resp != null ? resp.sum() : 0L;
    }

    public record SumResponse(String column, long sum, long rows) {}
}

This mirrors how analytics systems like Presto or Trino work: the storage engine (Parquet file on HDFS/S3) returns aggregates or filtered column chunks to the query coordinator. The Java coordinator never sees raw row data.

Part B — ParquetComparison: how parquet-mr reads column subsets

ParquetComparison.java documents the Apache Parquet (parquet-mr) read pattern — the production counterpart to our Parquet-lite engine. The key capability is column projection at the I/O layer:

// Declare projection: only read "id" and "price" columns
MessageType projection = MessageTypeParser.parseMessageType(
    "message orders { required int64 id; required double price; }"
);

// Build reader with projection
ParquetReader<GenericRecord> reader = AvroParquetReader
    .<GenericRecord>builder(HadoopInputFile.fromPath(path, conf))
    .withConf(conf)
    .build();

// Only "id" and "price" bytes are read from disk.
// All other column chunks are skipped at the I/O layer.
GenericRecord record;
long sum = 0;
while ((record = reader.read()) != null) {
    sum += ((Number) record.get("price")).longValue();
}
reader.close();

The critical difference from our toy: parquet-mr skips non-projected columns at the I/O layer, not at the filter layer. The file format stores each column as a separate byte range per row group. The reader can seek directly to the price column range and skip all other column ranges without reading them. Our implementation reads all column data and filters in memory.

Part C — What parquet-mr adds that our toy misses

The comparison table in ParquetComparison.java documents the gap:

Feature                  Parquet-lite (this lab)    Apache Parquet
-----------------------------------------------------------------
Column projection        Yes                        Yes
Row group pruning        Yes (min/max)              Yes (min/max + null_count)
Dictionary encoding      Yes (u8 codes)             Yes (RLE_DICTIONARY)
RLE encoding             Yes                        Yes (RLE_DICTIONARY fallback)
Bit-packing              Yes (manual)               Yes (DELTA_BINARY_PACKED)
Block compression        No                         Snappy, Zstd, GZIP, LZ4
Bloom filters            No                         Yes (per column per row group)
Nested types             No                         Yes (Dremel encoding)
Schema evolution         No                         Yes (column IDs survive renames)
S3 byte-range reads      Partial (footer design)    Yes (full implementation)

application.yml

columnar:
  base-url: http://localhost:8080   # Rust columnar-demo server (optional)
  parquet-file-path: /tmp/demo.parquet

management:
  endpoints:
    web:
      exposure:
        include: health, info

Run it

# Start the Spring Boot demo (Rust server is optional for the comparison demo)
cd labs/columnar-storage/java-integration
mvn spring-boot:run

Expected output:

=== Columnar Storage — Java/Spring Integration Demo ===

--- Apache Parquet (parquet-mr) Column Projection ---
parquet-mr would open orders.parquet, read footer to find row group offsets,
then issue byte-range reads for columns [id, price] only.
All other columns are skipped at the I/O layer — not just filtered in memory.

--- Predicate Pushdown (row group skipping) ---
parquet-mr uses FilterCompat.get(FilterApi.gt(doubleColumn("price"), 1000.0)).
At read time, each row group's ColumnChunkMetaData (min/max/null_count) is
checked before reading any data. Row groups where max(price) gt 1000.0 are
skipped entirely — 0 bytes read from their column chunks.

--- Parquet-lite vs Apache Parquet ---
Both support: column projection, row group pruning,
dictionary encoding, RLE, bit-packing.

Apache Parquet adds:
  - Snappy/Zstd block compression (50-100x vs raw)
  - Bloom filters (O(1) equality check per row group)
  - Nested types (LIST, MAP, STRUCT via Dremel encoding)
  - Schema evolution (column IDs survive renames)
  - S3 byte-range reads (footer-first, no full download)

=== Demo complete ===

What surprised me

Where to go deeper

  • Apache Parquet format spec: the full binary format including encoding types, page headers, and statistics — parquet.apache.org/docs/file-format/
  • Dremel paper (Google 2010): the original paper introducing nested columnar storage and the definition/repetition level encoding that Parquet uses for lists and structs
  • DuckDB’s execution model: how DuckDB achieves 100 GB/s scan speeds using vectorized (SIMD) column scans — duckdb.org/why_duckdb
  • Apache Arrow: the in-memory columnar format that complements Parquet on disk — enables zero-copy data exchange between systems that all use Arrow buffers
  • Parquet encoding types: PLAIN, RLE_DICTIONARY, DELTA_BINARY_PACKED, BYTE_STREAM_SPLIT — each optimised for different data distributions — parquet.apache.org/docs/file-format/data-pages/encodings/
  • Previous in storage: B+Tree KV Store — the row-oriented counterpart; understanding both reveals when to use OLTP vs OLAP storage layouts
  • Previous in storage: LSM-Tree KV Store — another storage engine optimised for writes; Parquet is optimised for reads
  • Related question: If you sort a Parquet file by timestamp before writing, how many row groups does a WHERE ts BETWEEN X AND Y query need to read? How does this compare to an unsorted file? What is the cost of sorting 1 billion rows before writing?
  • Design question: Parquet stores one column per byte range per row group. If you have 100 columns but queries always access 5, what happens to read amplification as you add more columns? How do column families in HBase solve this differently?