Interview's MateData Engineer
Interview's Mate

Data Engineer

SQL · Spark · Lakehouse · Streaming

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Data Engineer topics
Lesson 9/ 160
01. Data Engineering Foundations, Python & Linux

Working with File Formats (CSV, JSON, XML, Parquet, Avro, ORC)

Pick and parse the right interchange format for batch, streaming, and analytical workloads.

BeginnerParquet · Avro · JSON3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Append rows or scan columns. Next, required fields, types, and evolution. Finally, reader round-trip, counts, and compatibility.

Think of it like…

A file format is packaging: envelopes are easy to inspect, palletized boxes are efficient in bulk, and a manifest inside each crate tells an automated warehouse how to unpack it.

Where you’ve seen it

Kafka events use Avro with a registry subject and BACKWARD compatibility; a daily append lands as Snappy Parquet partitioned by event_date, while APIs exchange newline-delimited JSON for debugging.

Words you’ll hear

Parquet
A columnar format with encoding statistics and predicate pushdown, commonly the default for analytical object storage.
Avro
A compact row-oriented format with an embedded schema that is natural for Kafka records and serialization contracts.
JSON
A text format that is human-readable and broadly accepted, but has no native decimal distinction and often no schema by itself.
Operational boundary
CSV silently loses type information and new delimiters break quoted fields; JSON schema drift is hard to compact, while Parquet is efficient for analytics but awkward for single-row updates. Choose the format by access pattern, define schema and compatibility rules, write checksums and row counts, and use Parquet/ORC with a schema registry or manifest for analytical datasets.

Visual diagram

Loading interactive diagram

Theory & deep dive

Parquet: the working mechanism

File format selection is a contract between producer and consumer: CSV and JSON maximize interchange simplicity, Parquet and ORC optimize column scans, and Avro carries row-oriented schemas well for streams.

Append rows or scan columns. Required fields, types, and evolution, then date, decimal, null, and binary semantics; this exposes the state governed by JSON.

Working with File Formats in one concrete design

Kafka events use Avro with a registry subject and BACKWARD compatibility; a daily append lands as Snappy Parquet partitioned by event_date, while APIs exchange newline-delimited JSON for debugging.

Key takeaway: File format selection is a contract between producer and consumer: CSV and JSON maximize interchange simplicity, Parquet and ORC optimize column scans, and Avro carries row-oriented schemas well for streams

Working with File Formats: failure mode and production response

CSV silently loses type information and new delimiters break quoted fields; JSON schema drift is hard to compact, while Parquet is efficient for analytics but awkward for single-row updates.

Choose the format by access pattern, define schema and compatibility rules, write checksums and row counts, and use Parquet/ORC with a schema registry or manifest for analytical datasets. Track Parquet batch as "often 128 MiB–1 GiB logical target files", and make Avro unit visible to the dataset owner.

Key takeaway: Choose the format by access pattern, define schema and compatibility rules, write checksums and row counts, and use Parquet/ORC with a schema registry or manifest for analytical datasets.

How it works, step by step

Step 1 of 4
Parquet

1. Identify workload

Append rows or scan columns. File format selection is a contract between producer and consumer: CSV and JSON maximize interchange simplicity, Parquet and ORC optimize column scans, and Avro carries row-oriented schemas well for streams.

append rows or scan columns
Key numbers at this step
Parquet batch
often 128 MiB–1 GiB logical target files
Avro
A compact row-oriented format with an embedded schema that is natural for Kafka records and serialization contracts.

When to use it & trade-offs

What it is

File format selection is a contract between producer and consumer: CSV and JSON maximize interchange simplicity, Parquet and ORC optimize column scans, and Avro carries row-oriented schemas well for streams. Kafka events use Avro with a registry subject and BACKWARD compatibility; a daily append lands as Snappy Parquet partitioned by event_date, while APIs exchange newline-delimited JSON for debugging.

Why it matters: CSV silently loses type information and new delimiters break quoted fields; JSON schema drift is hard to compact, while Parquet is efficient for analytics but awkward for single-row updates. Choose the format by access pattern, define schema and compatibility rules, write checksums and row counts, and use Parquet/ORC with a schema registry or manifest for analytical datasets.

When to reach for it

  • Pick and parse the right interchange format for batch, streaming, and analytical workloads.
  • Choose Parquet because it provides this capability: A columnar format with encoding statistics and predicate pushdown, commonly the default for analytical object storage.
  • Keep evidence for Parquet batch at "often 128 MiB–1 GiB logical target files" so the last production stage-Validate - reader round-trip, counts, and compatibility-remains testable.

When to avoid or be careful

  • CSV silently loses type information and new delimiters break quoted fields; JSON schema drift is hard to compact, while Parquet is efficient for analytics but awkward for single-row updates.
  • Do not conflate Avro with Parquet. The second concept contributes different behavior: A compact row-oriented format with an embedded schema that is natural for Kafka records and serialization contracts.
  • Release only after this guardrail is in place: Choose the format by access pattern, define schema and compatibility rules, write checksums and row counts, and use Parquet/ORC with a schema registry or manifest for analytical datasets.

Parquet / Avro / JSON - roles, limits, and operating cost

Parquet
Best for: A columnar format with encoding statistics and predicate pushdown, commonly the default for analytical object storage.

Strengths: A columnar format with encoding statistics and predicate pushdown, commonly the default for analytical object storage. File format selection is a contract between producer and consumer: CSV and JSON maximize interchange simplicity, Parquet and ORC optimize column scans, and Avro carries row-oriented schemas well for streams.

Watch out: CSV silently loses type information and new delimiters break quoted fields; JSON schema drift is hard to compact, while Parquet is efficient for analytics but awkward for single-row updates.

Avro
Best for: A compact row-oriented format with an embedded schema that is natural for Kafka records and serialization contracts.

Strengths: A compact row-oriented format with an embedded schema that is natural for Kafka records and serialization contracts. In this workflow it supports: Encode - date, decimal, null, and binary semantics.

Watch out: The operating cost is real: one object schema plus many appended records.

JSON
Best for: A text format that is human-readable and broadly accepted, but has no native decimal distinction and often no schema by itself.

Strengths: A text format that is human-readable and broadly accepted, but has no native decimal distinction and often no schema by itself. Its output can be checked with Validation.

Watch out: Operating guardrail: Choose the format by access pattern, define schema and compatibility rules, write checksums and row counts, and use Parquet/ORC with a schema registry or manifest for analytical datasets.

Interview signals & numbers to know

When this topic comes up

  • “Where is the failure boundary for Parquet, and how would Parquet batch reveal it?”
  • “Why is Avro distinct from this behavior: a text format that is human-readable and broadly accepted, but has no native decimal distinction and often no schema by itself?”
  • Production clue: CSV silently loses type information and new delimiters break quoted fields; JSON schema drift is hard to compact, while Parquet is efficient for analytics but awkward for single-row updates.
  • Design probe: Choose the format by access pattern, define schema and compatibility rules, write checksums and row counts, and use Parquet/ORC with a schema registry or manifest for analytical datasets.

Benchmarks & rules of thumb

Parquet batch -
often 128 MiB–1 GiB logical target files
Avro unit -
one object schema plus many appended records
Validation -
row count, schema fingerprint, and checksum retained per file

Common mistakes & follow-ups

Common interview mistakes

  • CSV silently loses type information and new delimiters break quoted fields; JSON schema drift is hard to compact, while Parquet is efficient for analytics but awkward for single-row updates.
  • Reporting success from a job exit code without checking Parquet batch and Avro unit.
  • Treating this example as complete without replay, rollback, or access boundaries: Kafka events use Avro with a registry subject and BACKWARD compatibility; a daily append lands as Snappy Parquet partitioned by event_date, while APIs exchange newline-delimited JSON for debugging.

Likely interviewer follow-ups

  • How would you prove this contract instead of only checking that the command ran: A columnar format with encoding statistics and predicate pushdown, commonly the default for analytical object storage.
  • What does the recovery plan do when this occurs? CSV silently loses type information and new delimiters break quoted fields; JSON schema drift is hard to compact, while Parquet is efficient for analytics but awkward for single-row updates.
  • When is Parquet insufficient for Avro unit, and what does adding Avro cost in Parquet batch?
Interview tip: Lead with the data path and failure boundary: File format selection is a contract between producer and consumer: CSV and JSON maximize interchange simplicity, Parquet and ORC optimize column scans, and Avro carries row-oriented schemas well for streams. Then make the answer operational: Choose the format by access pattern, define schema and compatibility rules, write checksums and row counts, and use Parquet/ORC with a schema registry or manifest for analytical datasets.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Working with File Formats (CSV, JSON, XML, Parquet, Avro, ORC) with data engineer interview Q&A and hands-on practice.

Open Data Engineer Q&A →Machine Learning Q&A
Previous topic
Virtual Environments (uv, poetry, venv) & Dependency Management
Next topic
Row-Oriented vs Columnar Storage Formats & Compression (Snappy, Gzip, Zstd)