Delta tables¶
The pqbench library contains an optional Delta Lake table module that detects
a Delta table, reads its transaction log, and names the active Parquet files.
Measurement is a separate step: pqb ls files
emits the files, and pqb bytemass reads them. Delta dependencies are
feature-gated and remain out of the default dependency graph.
flowchart TD
delta_log[Delta transaction log] --> delta[pqbench::third_party::delta]
delta --> table[pqbench::table]
table --> document[TableFile documents]
document --> bytemass[pqbench::bytemass]
bytemass --> isolation[pqbench::third_party::object_store]
isolation --> object_store[object_store crate]
bytemass --> parquet[Parquet file footers]
pqbench_cli[pqbench-cli] --> delta
pqbench_cli --> bytemass
pqb ls files names the format before it reads anything. _delta_log is
Delta and wins UniForm; Iceberg has its own loader. The Delta module resolves
the table's snapshot with the Delta kernel and walks its active files.
It does not measure footers. pqbench::third_party::object_store adapts the
object_store crate to the small ObjectReader interface (stat +
read_range) the rest of the crate reads through; the Delta loader opens the
same store, through the kernel's re-export of that crate, so one store serves a
table's log and the footers behind it.
Usage¶
List the table's active files, then measure them. A terminal prints the files as a table:
$ cat docker/e2e-lakehouse/table.ndjson | pqb ls files | pqb fmt
path size_bytes
------------------------------------------------------------------- ----------
part-00000-5eef9a52-f717-4d78-8e62-d7a2a05c707b-c000.snappy.parquet 796
Build with the feature when you run from source: name the table on stdin, e.g.
echo '{"name":"catalogs/local/schemas/local/tables/events","uri":"./path/to/table"}' | cargo run -p pqbench-cli --features delta -- list files, or run
the same command in a container.
Remote tables are resolved with delta-s3 (which enables aws). The reader
resolves the table's vended lease itself — a direct catalog call, with no
in-process cache — and never writes it into the process environment or a
document.
The cargo command is
echo '{"name":"catalogs/local/schemas/local/tables/events","uri":"s3://bucket/table"}' | cargo run -p pqbench-cli --features delta-s3 -- list files.
A producer supplies the table URI as a table record; list files reads the
log, and bytemass reads the files under the lease the reader resolved. A
catalogs/local/... record is read with the ambient AWS_* environment,
because a catalog has nothing to vend for a path:
Backends¶
S3 support is compiled behind the aws feature inside
pqbench::third_party::object_store. A URI whose backend is
not compiled in fails at runtime with a message naming the missing feature.
Adding another scheme is one arm in the factory plus one feature. The delta
feature flag gates the loader; third_party/delta/impl is the only code that
names the delta_kernel crates. The kernel's reads are synchronous, so a load
runs them on a blocking thread, and the kernel's own engine runs its I/O on the
executor it owns. A table on S3 hands the engine the bucket's shared store, so
one client serves the table and every other read of the same bucket.
Document¶
list files resolves a snapshot and emits its active files as TableFile
records (name, blob, path, log size, logged modification time), each carrying
the table's lease; a file a later commit removed is absent. bytemass measures
each file as its line arrives and compares its size to the log. --last and
--partition keep only the files the log dates in a window. The stream is
NDJSON, and > captures it:
$ cat docker/e2e-lakehouse/table.ndjson | pqb ls files > /tmp/partition.ndjson
$ pqb bytemass < /tmp/partition.ndjson | pqb fmt
column type codec encoding bytes dict bytes bytes/row values
------ ---------- ------ -------- ----- ---------- --------- ------
id INT64 SNAPPY dict 66 37 22.00 3
label BYTE_ARRAY SNAPPY dict 72 43 24.00 3
Memory use¶
With NDJSON output, list files emits each active file as it is read, without
retaining a second complete history or file list in the CLI. A write blocks when
the output buffer fills, so a slow consumer still slows the producer — per
buffer rather than per row, since a row's own write is a copy.
A metadata-only caller asks for the header with LoadRequest::without_files():
the read resolves the kernel's snapshot without replaying its files, so the load
reports the snapshot version, schema, partition columns, and properties at O(1)
in files. pqb get table is that caller.
Resolving a snapshot's active files asks delta_kernel for the snapshot's
scan metadata: the kernel replays the log segment — the checkpoint's and the
commits' add and remove actions — and reconciles the live set, deletion
vectors included. Each file is written before the next batch is read, so memory
is one batch plus one file however large the table. The kernel's own stats
reader parses add.stats: a blob it cannot parse costs that file its statistics,
not the table. --last/--partition test the file's own logged time as it
arrives. Memory also includes the largest individual batch; human table output
buffers rows to align columns. The library API retains the files it reads.
list files reads the snapshot, not a window's commits: the kernel's scan
yields the active files, and the window is applied to each file's own logged time
as it arrives. A file a later commit removed is absent, and nothing below the
checkpoint is read.
Partition listing also reads the tombstones the retained JSON commits still
hold: delta_kernel's commit-range reader lists the log from the earliest
retained version to the snapshot's and projects only the remove actions,
newest first. A table whose commits are all checkpointed away has no tombstone
to read.
Limitations¶
Data paths must stay inside the table root (no URIs, no ..). A missing
delta feature fails at runtime and names the feature. Iceberg is detected
from metadata/version-hint.text or metadata/*.metadata.json and has its own
loader (Iceberg tables).
Dependencies¶
Delta resolution delegates to the Delta kernel (delta_kernel 0.30) and its
default engine. Delta dependencies are only built when the delta feature is
enabled.