liveBook · Manning

Row group

As explained in Fast Python: High performance techniques for large datasets

A row group is a storage and processing unit containing a subset of rows in a columnar data file.

A row group is a storage and processing unit containing a subset of rows in a Parquet columnar file. It stores every column for those rows, while larger files may contain multiple row groups. section 8.2.1

Row groups support practical file inspection and chunked processing:

  • Inspect metadata to count row groups, rows, columns, and total byte size. section 8.2.1
  • Write successive tables with ParquetWriter; each table becomes a separate row group. section 8.3.2
  • Read one row group at a time when memory or processing requirements make whole-file loading unsuitable. section 8.3.2
  • Treat row-group sizing as a chunking choice, while recognizing that dataset partitioning may further split data into files or row groups. section 8.3.2 section 8.2.3

Write and read row groups

Read CSV data in one-million-row chunks, convert each chunk to a PyArrow table, write each table through ParquetWriter, then iterate over pf.read_row_group(groupi) instead of loading the complete file. section 8.3.2

parquet_file = pq.ParquetFile("202001.parquet")
 
metadata = parquet_file.metadata
print(metadata)
print(parquet_file.schema)
group = metadata.row_group(0)
print(group)

Inspect ParquetFile metadata, schema, and the first row group to see its row count, columns, and byte size. section 8.2.1

How Fast Python: High performance techniques for large datasets covers it

How deep it goes
Defines row-group contents and demonstrates metadata, writing, and reading, but does not descend into lower-level storage internals.
Examples
Uses a 6,405,008-row file with one row group, seven generated row groups, and one-million-row input chunks.
What it assumes
Starts from the relationship between Parquet columns, rows, files, and chunks rather than requiring prior row-group knowledge.
What you can do after
Operate/configure PyArrow ParquetWriter and ParquetFile to create, inspect, and process row groups incrementally.
How it connects
Connects row groups to Parquet, columnar storage, chunking, metadata, partitioning, and PyArrow table processing.

Also explained in

Compare how 3 books explain row group →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fast Python: High performance techniques for large datasets. The section links point to the parts of the book it draws on.