2.1 File Formats & Serialization Characteristics

Key Takeaways

  • Columnar formats like Apache Parquet and ORC optimize analytical query performance (OLAP) by reading only requested columns and leveraging dictionary encoding and min/max statistics for projection and predicate pushdown.

  • Row-oriented formats like Apache Avro embed schemas in file headers and write consecutive records sequentially, making them ideal for high-throughput streaming event ingestion in Pub/Sub and Dataflow with full schema evolution support.

  • Splittable file formats and compression codecs (such as Snappy or containerized Avro/Parquet) allow distributed compute engines like Cloud Dataflow and Dataproc to partition workloads evenly across parallel worker nodes.

  • Non-splittable formats, including standard GZIP-compressed CSV and JSON, force a single distributed worker thread to read and decompress the entire file from byte zero, creating severe straggler bottlenecks.

  • In modern analytical architectures on Google Cloud, staging raw ingestion in Avro and transforming into Parquet or BigQuery native Capacitor storage represents an industry standard pattern.

Last updated: October 2026

2.1 File Formats & Serialization Characteristics

In modern data engineering on Google Cloud, data format selection is one of the most consequential architectural decisions you will make. The storage layout and serialization format directly govern read performance, write throughput, network egress, storage costs, and compute efficiency across services such as BigQuery, Cloud Storage, Dataproc, and Cloud Dataflow. Understanding the trade-offs between row-oriented and columnar architectures, serialization protocols, compression codecs, and distributed splittability is essential for the Google Cloud Associate Data Practitioner exam.


Core Data Formats in Google Cloud

Data pipelines encounter a wide variety of structured, semi-structured, and unstructured formats. Each format serves distinct stages of data ingestion, processing, and long-term analytics.

1. Comma-Separated Values (CSV)

CSV is a plain-text, row-delimited format where individual fields are separated by commas, tabs, or custom characters.

  • Structure and Schema: Schema is implicit or defined only in an optional header row. CSV lacks native data typing; every value is stored as text, requiring consumer engines to parse strings into integers, timestamps, or floating-point values at runtime.
  • Strengths: Universally supported, human-readable, and easily generated by legacy systems, spreadsheets, and transactional exports.
  • Limitations: Highly inefficient storage footprint, significant CPU overhead for parsing, no support for nested or repeated data structures, and severe splittability limitations when compressed with standard algorithms.

2. JavaScript Object Notation (JSON)

JSON is a semi-structured text format that organizes data into key-value pairs, arrays, and nested objects.

  • Structure and Schema: Self-describing and flexible. JSON accommodates schema changes such as sparse attributes and polymorphic records without requiring predefined schema registries.
  • Strengths: Ubiquitous in REST APIs, web applications, and application logs. Native support for complex hierarchical data structures.
  • Limitations: Substantial storage overhead caused by repeated key strings across millions of records. High parsing costs in analytical queries. When querying JSON directly in BigQuery or Spark, the engine must traverse repetitive text tokens, consuming far more resources than binary equivalents.

3. Apache Parquet

Apache Parquet is an open-source, binary columnar storage format specifically engineered for large-scale analytical processing (OLAP).

  • Structure and Schema: Parquet organizes data into self-contained row groups (typically 128 MB to 512 MB). Within each row group, data is partitioned by column into column chunks, which are further divided into pages. Schema definitions, column-level statistics (min/max values, null counts), and dictionary offsets are stored in the file footer.
  • Strengths: Unrivaled analytical read performance, massive storage savings through sophisticated encoding schemes (dictionary, run-length, bit-packing), and seamless integration with BigQuery external tables and Dataproc Spark jobs.
  • Limitations: High CPU and memory overhead during write operations. Not suitable for streaming single-record inserts or append-heavy micro-event pipelines.

4. Apache Avro

Apache Avro is an open-source, binary row-oriented serialization format designed by the Apache Hadoop project for data streaming and messaging systems.

  • Structure and Schema: Avro pairs compact binary record data with an embedded JSON schema stored directly in the file header. Data blocks are separated by 16-byte synchronization markers.
  • Strengths: High write throughput, minimal serialization overhead, compact binary representation, and industry-standard schema evolution capabilities (backward, forward, and full compatibility). It is the premier choice for message brokers (Apache Kafka, Google Cloud Pub/Sub) and real-time streaming engines (Cloud Dataflow).
  • Limitations: Inefficient for analytical queries scanning a small subset of columns across billions of rows, as full rows must be read into memory.

5. Optimized Row Columnar (ORC)

ORC is a columnar storage format originally created for Apache Hive within the Hadoop ecosystem.

  • Structure and Schema: ORC divides data into large stripes (64 MB by default in Apache ORC). Each stripe contains index data, row data divided into column streams, and a stripe footer containing stream locations and column statistics.
  • Strengths: Excellent compression, built-in light-weight indexes, and integer dictionary encodings. Commonly encountered when migrating on-premises Hive and Hadoop workloads to Google Cloud Dataproc.
  • Limitations: Less universally adopted across the broader cloud analytics ecosystem than Parquet.

6. Structured Database Tables

The exam guide also lists structured database tables as a source format. Rows in Cloud SQL, AlloyDB, Spanner, or an on-premises database already have a strict schema enforced by the database engine. You extract them with Database Migration Service, Datastream, Dataflow (JDBC), or a BigQuery federated query rather than handling files.

Structured, Semi-Structured, and Unstructured Data

Classifying the data is usually the first step in choosing where it should live:

ClassWhat it looks likeExamplesTypical Google Cloud home
StructuredFixed columns and typesDatabase tables, CSV exports, Parquet filesBigQuery, Cloud SQL, AlloyDB, Spanner
Semi-structuredSelf-describing keys, nesting, optional fieldsJSON events, Avro records, logs, XMLBigQuery (JSON, STRUCT, ARRAY types), Firestore, Bigtable
UnstructuredNo tabular schemaImages, audio, video, PDFs, free textCloud Storage (queryable through BigQuery object tables)

Which File Format Loads Best into BigQuery?

Google's loading guidance ranks Avro as the preferred format: its blocks can be read in parallel even when compressed, and it carries its own schema and logical types. Parquet and ORC are also efficient and self-describing. Uncompressed CSV or newline-delimited JSON loads faster than gzip-compressed CSV or JSON, because BigQuery cannot split a gzip file across workers (and caps each compressed CSV or JSON file at 4 GB).


Row-Oriented vs. Columnar Storage Architecture

To select the right format, you must understand the physical layout of bits on disk and in memory.

Row-Oriented Layout (Avro / CSV):
[Row 1: ID, Timestamp, Customer, Amount, Status] [Row 2: ID, Timestamp, Customer, Amount, Status] ...

Columnar Layout (Parquet / ORC):
[All IDs] [All Timestamps] [All Customers] [All Amounts] [All Statuses]

Memory and Disk Layout Mechanics

  • Row-Oriented Layout: All attributes of record 1 are stored contiguously, followed by all attributes of record 2. This layout maximizes throughput when an application reads or writes an entire record at once. For transactional systems (OLTP) and streaming ingest where individual events are generated independently, row-oriented layout ensures that a single disk write or network packet captures the complete state.
  • Columnar Layout: Values of the same attribute across millions of rows are grouped into contiguous storage blocks. Because values in a single column share the identical data type and often exhibit repetitive patterns, columnar layouts achieve dramatic data compression ratios.

I/O Efficiency, Projection Pushdown, and Predicate Pushdown

Analytical queries rarely need all columns. Consider the following SQL query executed on a table containing 100 columns and 500 million rows:

SELECT customer_id, SUM(amount) 
FROM transactions 
WHERE status = 'COMPLETED' 
GROUP BY customer_id;
  1. I/O Efficiency: In a row-oriented format, the storage engine must read every single byte of all 100 columns off disk, pull them across the network, and discard the 97 unneeded columns in memory. In a columnar format, the storage engine reads only the byte blocks allocated to customer_id, amount, and status. Disk and network I/O are reduced by 90% or more.
  2. Projection Pushdown: The query engine pushes the column projection (customer_id, amount, status) down to the storage layer, instructing it to fetch only the byte ranges corresponding to those specific columns. BigQuery external tables and Dataproc Spark jobs leverage projection pushdown to minimize query execution time and Cloud Storage egress costs.
  3. Predicate Pushdown: Parquet file footers and ORC stripe footers store metadata summaries for every row group, including minimum and maximum values for each column. When evaluating WHERE status = 'COMPLETED', the storage reader inspects the footer metadata. If a row group's status column chunk has min = 'PENDING' and max = 'PENDING', the query engine skips reading and decompressing the entire 128 MB row group entirely. This metadata-driven pruning is called predicate pushdown.

Workload Optimization: OLAP vs. Streaming Ingestion

RequirementOptimal ArchitectureRecommended FormatPrimary Google Cloud Engine
Analytical Aggregations (OLAP)ColumnarApache Parquet / ORCBigQuery, Dataproc (Spark SQL)
High-Velocity Event StreamsRow-OrientedApache AvroPub/Sub, Cloud Dataflow
Schema Evolution & ContractsRow-OrientedApache AvroCloud Dataflow, Schema Registry
Ad-Hoc Data ExplorationSemi-StructuredJSON / CSVCloud Storage staging, BigQuery

Why Columnar Formats Excel for Analytical Queries (OLAP)

Analytical queries scan billions of rows to calculate aggregates (SUM, AVG, COUNT), join large datasets, and evaluate complex filters. Because columnar files group homogeneous data together, compression algorithms can employ specialized encodings:

  • Dictionary Encoding: Replaces repetitive strings (e.g., state codes or product categories) with small integer keys, storing a single lookup dictionary per page.
  • Run-Length Encoding (RLE): Collapses consecutive identical values into a value-and-count pair (e.g., storing ten thousand consecutive zeroes in a few bytes).
  • Bit-Packing: Truncates integers to the minimum number of bits required to store their values.

In Google Cloud, querying Parquet files via BigQuery external tables or BigLake tables allows you to perform petabyte-scale queries while paying only for the bytes in the specific columns read.

Why Row-Oriented Formats Excel for Streaming and Event Ingestion

Streaming pipelines ingesting data from mobile clients, webhooks, or IoT devices via Google Cloud Pub/Sub process events continuously one by one. Converting each arriving record into a columnar structure in real time is computationally prohibitive; the worker would have to buffer thousands of rows in memory to form viable column chunks before writing them to disk.

Apache Avro is ideal here. Its row-oriented binary structure writes complete records sequentially with virtually zero buffer overhead. Furthermore, Avro's embedded JSON schema enables robust schema evolution:

  • Backward Compatibility: A newer schema version can read data written with an older schema (essential when adding optional fields with default values).
  • Forward Compatibility: An older schema version can read data written with a newer schema (allowing consumers to safely ignore newly added fields).
  • Full Compatibility: Schemas can evolve bidirectionally without requiring coordinated redeployment of upstream producers and downstream Dataflow pipelines.

Compression Codecs and Distributed Splittability

Distributed compute systems such as Cloud Dataflow (Apache Beam) and Dataproc (Apache Spark/Hadoop) achieve horizontal scalability by partitioning data across dozens or hundreds of worker nodes.

Splittable Format (Parquet / Avro / Raw CSV):
File [======== 256 MB ========]
Worker 1 reads [0 MB - 64 MB]   --> Finds Sync / RowGroup boundary
Worker 2 reads [64 MB - 128 MB] --> Finds Sync / RowGroup boundary
Worker 3 reads [128 MB - 192 MB]--> Finds Sync / RowGroup boundary
Worker 4 reads [192 MB - 256 MB]--> Finds Sync / RowGroup boundary

Non-Splittable Format (GZIP-compressed CSV):
File [======== 256 MB .csv.gz ========]
Worker 1 MUST read [0 MB to 256 MB] sequentially alone!
(Workers 2, 3, 4 sit idle --> Straggler Bottleneck!)

Understanding Splittability

A file is splittable if a distributed processing framework can assign arbitrary byte ranges (splits) of a single file to different workers. For instance, Worker 1 reads bytes 0 to 64,000,000, while Worker 2 reads bytes 64,000,001 to 128,000,000. For this to work, Worker 2 must be able to seek directly to byte 64,000,001, scan forward to identify the start of the next complete record, and begin parsing without reading the preceding bytes.

Compression Codec Profiles

  • Snappy: Developed by Google, Snappy prioritizes high decompression speed and low CPU utilization over maximum compression ratios. Snappy operates on small independent blocks, making it splittable when embedded inside container formats. It is Spark's default Parquet codec (so it is everywhere on Dataproc) and a common choice for Avro files.
  • GZIP: Employs the DEFLATE algorithm, achieving excellent compression ratios (typically 60-80% size reduction on text data). However, GZIP operates as a single, continuous sliding-window bitstream. A standalone .csv.gz or .json.gz file is not splittable. A worker cannot begin decompressing at byte offset 64 MB because it lacks the decompression dictionary built from bytes 0 through 64 MB. Consequently, a 50 GB .csv.gz file forces Dataflow to assign the entire file to a single worker thread, causing an extreme processing bottleneck ("straggler problem").
  • zstd (Zstandard): Modern compression algorithm developed by Meta. It delivers compression ratios comparable to GZIP with decompression speeds approaching Snappy. Widely supported across modern Parquet implementations.
  • bzip2: A block-based compression algorithm that is inherently splittable even for plain text files, but incurs heavy CPU decompression penalties.

Containerized Splittability Rule: When compression codecs like GZIP or Snappy are applied inside container formats like Apache Avro or Apache Parquet, the compression is scoped to individual, self-contained data blocks (Avro blocks between sync markers, or Parquet row groups/pages). Because workers can seek directly to container boundaries, Parquet and Avro files remain fully splittable regardless of internal compression codec!


Comparative Evaluation Matrix

FormatOrientationSplittabilityTypical CodecsSchema EvolutionPrimary GCP Use Case
CSVRowYes (uncompressed) / No (GZIP)GZIP, bzip2Very Poor (manual headers)Legacy data exchange, spreadsheet ingest
JSONRow (Hierarchical)Yes (uncompressed) / No (GZIP)GZIPModerate (flexible, untyped)REST API logs, Pub/Sub raw payloads
Apache ParquetColumnarYes (always, via row groups)Snappy, zstd, GZIPGood (column metadata in footer)BigQuery external/BigLake tables, Dataproc OLAP
Apache AvroRowYes (via 16-byte sync markers)Snappy, DeflateExcellent (JSON schema in header)Pub/Sub streaming, Dataflow pipelines, Kafka
ORCColumnarYes (via stripe boundaries)ZLIB, SnappyGood (stripe footers)Dataproc Hive and Spark legacy migrations

Common Exam Traps & Scenario Questions

  • Exam Trap 1: The Compressed CSV Bottleneck in Dataflow. A common exam question presents a scenario where a Cloud Dataflow batch pipeline processing a 100 GB compressed CSV dataset is running on 30 workers, but only 1 worker is doing all the work while the rest remain idle. The trap is attempting to solve this by adding more workers or increasing worker RAM. The correct solution is converting the input data into a splittable format (such as Apache Parquet with Snappy or uncompressed CSV) so Dataflow can split the file across worker threads.
  • Exam Trap 2: Using Parquet for Real-Time Streaming Ingestion. Questions may ask which format to use for ingesting individual sensor events into Cloud Storage via Pub/Sub and Dataflow with sub-second latency. Recommending Parquet is a trap; Parquet requires buffering hundreds of megabytes of records to construct valid column chunks and footer metadata. The correct answer is Apache Avro (or JSON), followed by periodic batch compaction into Parquet.
  • Exam Trap 3: Assuming BigQuery Requires Ingesting Parquet Before Querying. BigQuery can query Parquet files directly in Cloud Storage using external tables or BigLake tables with zero ingest delay, leveraging Parquet's projection and predicate pushdown natively.
Loading diagram...
Optimal File Format Flow: Avro for Ingestion to Parquet for OLAP
Test Your Knowledge

A data engineering team is designing a high-throughput streaming ingestion pipeline using Google Cloud Pub/Sub and Cloud Dataflow. Upstream microservices emit schema-bound transactional events with frequent additions of optional metadata fields. The team requires minimal serialization latency and robust backward and forward compatibility without breaking downstream consumers. Which data format should the team select?

A

Apache Parquet

B

Apache Avro

C

Optimized Row Columnar (ORC)

D

Uncompressed CSV

Test Your Knowledge

A 200 GB dataset containing historical server access logs is stored in Cloud Storage. A Cloud Dataflow batch pipeline that reads these logs is experiencing severe performance degradation because all processing is routed to a single worker instance, leaving the remaining cluster workers idle. An investigation reveals the data is stored in comma-separated text files compressed with standard GZIP (.csv.gz). How can the engineering team resolve this bottleneck?

A

Partition the Cloud Storage bucket into multiple subdirectories with virtual folder prefixes.

B

Increase the vCPU and RAM allocated to the single Dataflow worker machine type.

C

Convert the dataset to Apache Parquet with Snappy compression, or store the CSV files uncompressed.

D

Convert the CSV files into compressed JSON files using the same GZIP compression algorithm.

Test Your Knowledge

An analyst executes an ad-hoc query against a 5 TB Apache Parquet dataset stored on Cloud Storage using BigQuery external tables. The query filters for a specific customer ID (WHERE customer_id = 45892) and selects only the transaction timestamp and total amount (SELECT transaction_time, total_amount). Which storage optimizations allow BigQuery to scan only a tiny fraction of the 5 TB dataset?

A

Dynamic work rebalancing and shuffle sharding.

B

Projection pushdown and predicate pushdown.

C

Full-table streaming buffer de-duplication.

D

Row-level locking and primary key index scanning.

Sections you finish are checked off in the contents.