Self-Assessment Quiz: File Formats and Serialization

Twenty questions. Aim for 16 or more.


Question 1

The two questions a format choice comes down to are who reads it and how, and:

  • A. How fast it compresses
  • B. Where the schema lives
  • C. Which cloud it runs on
  • D. Whether it supports nesting

Question 2

A format with a schema registry differs from all the others because a mismatch is found:

  • A. At read time, immediately
  • B. At write time, in the producer, before the bad data exists
  • C. At compile time
  • D. During compaction

Question 3

A 4 GB whole-file-gzipped JSON file uses one core because:

  • A. gzip is single-threaded
  • B. It is not splittable — it cannot be divided at arbitrary boundaries
  • C. JSON parsing cannot be parallelized
  • D. The file exceeds a block size limit

Question 4

Which is NOT one of CSV's problems?

  • A. No types — everything is text
  • B. Ambiguous null representation
  • C. Poor compression ratio
  • D. No standard, despite RFC 4180

Question 5

JSON's disqualifying property as a data file is:

  • A. Verbosity
  • B. A JSON array is a single value, so the file must be parsed end to end before any record is available
  • C. Lack of type support
  • D. No nesting support

Question 6

Avro dominates streaming primarily because:

  • A. It is the fastest to parse
  • B. Its schema evolution is a first-class, well-specified feature — which is what makes a registry possible
  • C. It is columnar
  • D. It has the best compression

Question 7

Reading one field of a million Avro records reads:

  • A. Only that field
  • B. All fields of all million records
  • C. Only the records matching a predicate
  • D. The file header only

Question 8

Choose ORC over Parquet when:

  • A. You need better compression
  • B. You are in a Hive-centric ecosystem or using ACID Hive tables
  • C. You have nested data
  • D. You need faster writes

Question 9

Kestrel's layer approach to schemas is:

  • A. Schema-on-write everywhere
  • B. Schema-on-read everywhere
  • C. Schema-on-read in bronze, schema-on-write in silver and gold
  • D. Schema-on-write in bronze, schema-on-read downstream

Question 10

In the §11.6 benchmark, which format beat Parquet + snappy on size?

  • A. JSON Lines + gzip
  • B. CSV + gzip
  • C. Plain CSV
  • D. Avro + deflate

Question 11

What does that result tell you?

  • A. Columnar formats are overrated
  • B. Columnar's advantage is not primarily compression — it is what you can avoid reading
  • C. snappy should never be used
  • D. The benchmark was flawed

Question 12

Parquet + zstd versus Parquet + snappy in the benchmark was a difference of about:

  • A. 1.05×
  • B. 1.6×
  • C. 4×
  • D. 12×

Question 13

Sorting by session before writing made the file:

  • A. 30% smaller
  • B. 3.4% smaller
  • C. 3.4% larger
  • D. Exactly the same size

Question 14

Why?

  • A. Sorting adds metadata overhead
  • B. The events already arrived in timestamp order, and sorting destroyed the delta encoding on event_ts
  • C. session_id is high cardinality
  • D. zstd cannot exploit sort order

Question 15

The rule that survives measurement is:

  • A. Always sort before writing
  • B. Never sort before writing
  • C. Sorting helps when the data has no useful order and hurts when it destroys one it already had
  • D. Sort only low-cardinality columns

Question 16

The same benchmark code gave 19.3× and 13.3× depending on:

  • A. The compression level
  • B. The row group size
  • C. The cardinality of a few text fields
  • D. The number of events

Question 17

Kestrel's production ratio, from Chapter 1, is:

  • A. 19.3×
  • B. 13.3×
  • C. 12.3×
  • D. 8.0×

Question 18

A one-column aggregate over one day reads roughly how much less from Parquet than from gzipped JSON?

  • A. 2× less
  • B. 10× less
  • C. 100× less
  • D. 1,000× less

Question 19

This book's default codec for stored analytical data is:

  • A. snappy
  • B. gzip
  • C. zstd
  • D. brotli

Question 20

Of the three format mistakes, which does the chapter say to fix first?

  • A. CSV as internal storage
  • B. Row formats for analytical data
  • C. Layout — because format is worth a factor of a few and layout a factor of tens
  • D. Wrong codec

Answer Key

1. B — §11.1. And the second question determines where the cost of a mismatch lands.

2. B — §11.5. Every other option finds the problem in the consumer. That is a categorical difference and it is why Chapter 17 exists.

3. B — §11.1. A common and infuriating source of "why is this job not parallelizing."

4. C — §11.2. Gzipped CSV compresses well — it beat Parquet + snappy in the benchmark. The problems are types, schema, standard, nulls, delimiters, and splittability when compressed.

5. B — §11.2. JSON Lines fixes exactly this, and makes a corrupt line cost one record rather than a file.

6. B — §11.3. Avro specifies exactly which changes are backward, forward, or fully compatible.

7. B — §11.3. Chapter 7 §7.2's problem, in a file.

8. B — §11.4. The deciding factor is ecosystem rather than technology.

9. C — §11.5. Bronze cannot lose what it did not reject; silver enforces the contract.

10. B — §11.6. 19.93 MB against 20.35 MB.

11. B — §11.6, finding 1. General-purpose compressors capture much of the same redundancy in a text file. The advantage that matters does not appear in a size comparison.

12. B — §11.6. 12.56 MB against 20.35 MB, from changing one parameter.

13. C — §11.6, finding 2. Larger. Chapters 8 and 9 both said sorting helps, and both were describing the common case.

14. B — §11.6. Consecutive timestamps differ by a constant, which delta-encodes almost perfectly; sorting by session scattered them.

15. C — §11.6, 📐 callout. For append-only event data, sort by time — which usually means do nothing.

16. C — §11.6, finding 3. Paths, referrers, and user agents. Same code, same formats, same codec.

17. C — §11.6 and Chapter 1 §1.5. The high-cardinality synthetic landed at 13.3×, close to it.

18. C — §11.7. ~1.08 GB against ~9.4 MB, and that gap is invisible in a compression comparison.

19. C — §11.8. 1.6× smaller than snappy at comparable speed — the one codec choice this book is confident about.

20. C — §11.9. Chapter 9's Case Study 1: 340,000 files of perfectly good Parquet were 19× slower than 1,712 files of the same Parquet.


Topic map

Missed Reread
1, 2, 3 §11.1 — the two questions and splittability
4, 5 §11.2 — text formats
6, 7 §11.3 — Avro
8 §11.4 — Parquet and ORC
9 §11.5 — where the schema lives
10, 11, 12, 13, 14, 15, 16, 17 §11.6 — the measurement
18 §11.7 — scan cost
19 §11.8 — codecs
20 §11.9 — choosing