# compara: the whole documentation > compara compares two tables on a composite key, extremely fast: CSV, TSV, JSON and Parquet, local or in object storage, with counts, per-column statistics, a JSON summary and a self-contained HTML report. One Rust binary. Pages in site order; each is also at https://andrey-usa.github.io/compara/.md. # compara Extremely fast table comparison: two tables on a composite key, with counts, per-column statistics and a self-contained HTML report. One tool for every recurring comparison: a nightly export against yesterday's, a CSV against the Parquet a warehouse emits, a migration's source against its target. > Faster software for a better planet — less energy, less compute, more time for life. - Reads **CSV, TSV, JSON (newline-delimited or one array of objects) and Parquet**, and the two sides need not be in the same format. - Ten million rows × 20 columns of CSV in about a second on GitHub's 4-core runner with the files cached, where the fastest of DuckDB, Polars, qsv and ClickHouse takes about 10 s; on Parquet as Polars or DuckDB write it, about twice as fast as the fastest of them (1.7–2.2 s vs 3.9–4.7 s); from a cold disk, little more than the time to read the files (CSV 9.3 s vs 8.6 s to read) ([benchmarks](benchmarks/results.md)). - Reads and writes **object storage and the web** directly (`s3://`, `gs://`, `az://`, `https://`), with each cloud's own credentials, and fetches only the Parquet columns it compares ([object storage](guides/cloud.md)). - One static binary, and a distroless container image; the report is a single HTML file with nothing to host. - Exit codes made for pipelines: `0` identical, `1` differences, `2` error, `3` duplicate keys (with `--fail-on-dups`). ## Start - [Install](start/install.md): Every way to install compara: prebuilt binaries, package managers and the container image. - [Quick start](start/quick-start.md): Two example exports compared, from the counts to the HTML report. - [Everyday comparisons](start/tutorial.md): The comparisons people run most, and what compare writes and when. ## Guides - [Compare tables in object storage and on the web](guides/cloud.md): Compare tables on S3, GCS, Azure or a web server, with each cloud's own credentials, partitioned tables and Delta versions. - [Run compara in a container, in CI or in Kubernetes](guides/containers.md): The container image, how compara keeps to a container's limits, the GitHub Action and a Kubernetes Job. - [Name a recurring comparison](guides/profiles.md): Give a comparison you run often a name in compara.toml, and the example pair the repository ships. ## Concepts - [Engines and formats](concepts/engines.md): The three engines and their shared result contract, and how each input format is read. ## Reference - [compare options](reference/options.md): Every option of compare, duplicate keys and profiles. - [The JSON summary](reference/json-summary.md): The shape of the summary `--json` writes, as a JSON Schema. - [compara --help](reference/help.md): The commands and options exactly as this build prints them. ## Agents - [For AI agents](agents/overview.md): What an agent gets: a JSON result, exit codes it can branch on, a read-only default, and these docs as markdown. - [Skill](agents/skill.md): The guide `compara skill` gives an agent, as this version prints it. ## Benchmarks - [Results](benchmarks/results.md): compara against DuckDB and Polars on the same comparisons, local and on object storage, each number with its CI run. - [Where compara is not ahead](benchmarks/losses.md): Each measure on which another tool beat compara in the same run. ## Project - [Changelog](project/changelog.md): What changed in each release, and what is on the way. - [Contributing](project/contributing.md): How to build, test and benchmark compara, and the performance gate every change passes. - [Security](project/security.md): What compara protects and how, and how to report a problem. Built from commit [c2d955a](https://github.com/andrey-usa/compara/commit/c2d955a), 81 commits after v0.8.0, of 2026-11-25; `compara --version` says `compara 0.9.0`. These docs are ahead of the 0.8.0 release: what the [changelog](project/changelog.md#unreleased) lists under Unreleased is not in 0.8.0 yet. # Install Every way to install compara: prebuilt binaries, package managers and the container image. Prebuilt binaries for Linux (x86_64, aarch64), macOS (arm64, x86_64) and Windows (x64) are on the [releases page](https://github.com/andrey-usa/compara/releases), and the same binaries through package managers: | Channel | Command | |---|---| | Cargo | `cargo install --locked compara` | | pip / uv | `pip install compara` · `uv tool install compara` | | Homebrew | `brew install andrey-usa/tap/compara` | | Scoop | `scoop bucket add andrey-usa https://github.com/andrey-usa/scoop-bucket` then `scoop install compara` | | Docker | `docker run --rm -v "$PWD:/data" ghcr.io/andrey-usa/compara compare a.csv b.csv -k id` | --- Made from [README.md](https://github.com/andrey-usa/compara/blob/main/README.md). # Quick start Two example exports compared, from the counts to the HTML report. ```console $ compara compare examples/orders_2026-08.csv examples/orders_2026-09.csv -k order_id,line_no -i updated_at A 800 rows | B 799 rows | matched 787 (changed 102) | added 10 | removed 12 | duplicate keys A 1, B 1 | engine turbo, 0.011s note: column only in B, not compared: carrier $ echo $? 1 $ compara compare examples/orders_2026-08.csv examples/orders_2026-09.csv -k order_id,line_no -i updated_at -o report.html A 800 rows | B 799 rows | matched 787 (changed 102) | added 10 | removed 12 | duplicate keys A 1, B 1 | engine turbo, 0.001s Report: report.html (20 KB) note: column only in B, not compared: carrier ``` Two monthly order exports from the repository's `examples/`, keyed on `(order_id, line_no)`, with `updated_at` left out. Exit code 1 says they differ; the report holds the counts, per-column statistics and the changed, added, removed and duplicate rows. The note names a column only one of the files has: it is not compared, and it does not change the exit code. More: [Everyday comparisons](tutorial.md), and every option of `compare`: [compare options](../reference/options.md). --- Made from [README.md](https://github.com/andrey-usa/compara/blob/main/README.md). # Everyday comparisons The comparisons people run most, and what compare writes and when. ```sh compara compare a.csv b.csv -k account_id,txn_id -i updated_at compara compare a.csv b.csv -k account_id,txn_id -i updated_at -o report.html compara compare a.csv b.csv -k account_id,txn_id --trim --tolerance 0.005 compara compare export.csv warehouse.parquet -k id compara compare a.csv b.csv --profile orders --json summary.json --export-dir out/ compara columns data.parquet # column names (reads only the footer) compara head data.ndjson -n 5 # first rows, aligned ``` `compare` prints the counts and writes nothing else unless asked. `-o PATH` writes the HTML report: counts, per-column statistics, and the changed, added, removed and duplicate rows, each section capped at `--max-rows` (counts are always exact). [`examples/report.html`](https://github.com/andrey-usa/compara/blob/main/examples/report.html) is one, made from the two files next to it: ```sh compara compare examples/orders_2026-08.csv examples/orders_2026-09.csv -k order_id,line_no -i updated_at -o examples/report.html ``` --- Made from [docs/tutorial.md](https://github.com/andrey-usa/compara/blob/main/docs/tutorial.md). # Compare tables in object storage and on the web Compare tables on S3, GCS, Azure or a web server, with each cloud's own credentials, partitioned tables and Delta versions. Any file argument can be a URL, and so can `-o`, `--json` and `--export-dir`: ```sh compara compare s3://lake/orders/2026-09.parquet s3://lake/orders/2026-10.parquet -k order_id \ --json s3://reports/orders/summary.json --export-dir s3://reports/orders/diff/ compara compare gs://bucket/export.csv.gz az://container/warehouse.parquet -k id compara compare s3://lake/orders/run=41/ 's3://lake/orders/run=42/date=2026-10-*/*.parquet' -k order_id compara compare "https://bucket.s3.amazonaws.com/a.csv?X-Amz-Signature=..." b.csv -k id aws s3 cp s3://bucket/a.ndjson - | compara compare - b.ndjson -k id --json - ``` | Scheme | Credentials, as that cloud's own tools find them | |---|---| | `s3://`, `s3a://` | `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` / `AWS_SESSION_TOKEN`, a `~/.aws` profile (`AWS_PROFILE`) -- static keys, or SSO, an assumed role or a `credential_process`, resolved the way the AWS CLI resolves them -- web identity (EKS), the ECS task role, instance metadata. `AWS_ENDPOINT_URL` for MinIO, R2, Ceph and the like. The bucket's region is looked up when none is set. | | `gs://` | `GOOGLE_APPLICATION_CREDENTIALS`, application default credentials (`gcloud auth application-default login`), the metadata server (GKE, Cloud Run). | | `az://`, `abfs(s)://`, `azure://`, `adl://` | `AZURE_STORAGE_ACCOUNT_NAME` with a key (`AZURE_STORAGE_ACCOUNT_KEY`), a SAS token (`AZURE_STORAGE_SAS_KEY`), a service principal, managed or workload identity, or an `az login` when there is nothing else. | | `http://`, `https://` | none: the URL is fetched as given, so a presigned S3 URL or an Azure SAS URL works as it is. A refused one that names a bucket or a storage account is retried signed. | - **No credentials, no setup**: with none to be found, a public bucket (open data on S3 or GCS) is read unsigned, and the note on stderr says so; a private one fails with what to set. - **Parquet is read as far as the comparison reads it**: the footer, then only the column chunks of the key and compared columns. `--compare` on two columns of a 200-column table fetches those two; `compara columns` fetches the last 64 KB. - **Everything else is read in parallel ranges** (8 MB, sixteen at a time, `COMPARA_FETCH_CONCURRENCY`) into a temporary file in `TMPDIR`. Gzip and zstd files, local or remote, are read as what they hold; one that expands past 1 GB to more than 1000 times its size is refused as a decompression bomb (`COMPARA_MAX_EXPANSION=`, 0 for no limit). - **Link-local addresses are not read**: an `http(s)://` table at 169.254.0.0/16, fe80::/10 or fd00:ec2::254 (where cloud machines get their credentials), by address, by name or by a redirect, is refused; `COMPARA_ALLOW_LINK_LOCAL=1` allows it. Redirects stop after 10. - **A table of many files is one side**: a directory, a quoted glob, or an object storage prefix is its files read as one table, in path order: Spark and Hive output (`date=2026-10-01/part-00000.snappy.parquet`), a warehouse unload (`unload/0000_part_00.csv.gz`). CSV parts must share a header and Parquet parts a schema, and the error names the part that does not. From object storage the parts are fetched together, sixteen ranges in flight across all of them, and Parquet parts only as far as the comparison reads them. Hive partitions are columns: under `orders/`, the parts of `date=2026-10-01/region=eu/` carry `date` and `region` (as text), so `-k date,order_id` keys a table whose ids repeat from day to day, and a partitioned table compares with a flat export that has those columns. A part whose rows hold such a column too takes the directory's value in every row, as DuckDB and Polars read the table. Names starting with `.` or `_` (`_SUCCESS`, `.crc`) are passed over. - **A Delta table is read at a version**: `s3://lake/orders/` is its latest version, `s3://lake/orders@v41` the forty-first: the files its log (`_delta_log/`, checkpoint and commits) says make that version, and no others, so two versions compare like two tables: `compara compare s3://lake/orders@v41 s3://lake/orders -k order_id`. Deletion vectors and column mapping are refused rather than read wrong; an Iceberg table is refused. - **Every range is read from one version of the object** (`If-Match` on its ETag, and each answer's ETag and size checked, for servers that ignore `If-Match`): an object overwritten mid-read is an error, not a file stitched from two versions. Throttled and dropped ranges are retried, and so is a request whose server sends nothing for 30 s (`COMPARA_READ_TIMEOUT`); a slow one that keeps sending is waited for. A server that sends nothing on any request for twice that is an error. - **Outputs go up** in one request, or as a multipart upload for a large export. `--json -` prints the summary on stdout and the counts on stderr. A plain `http(s)://` PUT is sent from the file as the server takes it; a server that stops taking it, or never answers, is an error after 30 s (`COMPARA_READ_TIMEOUT`) and the time what it may still be reading would take at 16 KB/s: a server taking it at 16 KB/s or more is waited for, and the error names that floor. --- Made from [docs/guides/cloud.md](https://github.com/andrey-usa/compara/blob/main/docs/guides/cloud.md). # Run compara in a container, in CI or in Kubernetes The container image, how compara keeps to a container's limits, the GitHub Action and a Kubernetes Job. - `ghcr.io/andrey-usa/compara` is the release binary on `gcr.io/distroless/cc` for `linux/amd64` and `linux/arm64`, running as a non-root user with `WORKDIR /data`. Nothing else is in the image. - It reads the container's limits: threads from the CPU quota, memory from the cgroup. **Out of memory is a message, not an OOM kill**: the heap is held a margin under the limit, so a pair that does not fit is refused with what needed how much (exit 2), and under `--engine auto` a CSV pair is compared by the engine that spills to disk instead, with the same answer. - A read-only root filesystem works; standard input, compressed and remote inputs and the spilling engine need a writable `TMPDIR`; in Kubernetes an `emptyDir` (disk-backed: a `medium: Memory` one counts against the memory limit). - `compara env` prints what the process sees: CPUs, memory, the container's limit, the heap limit it set, and whether the temporary directory is writable. In GitHub Actions, the action installs the release binary, writes the counts and the most-changed columns to the job summary, and fails the step when the tables differ (`fail-on-differences: false` to only report): ```yaml - uses: aws-actions/configure-aws-credentials@v5 # or any other credentials with: {role-to-assume: arn:aws:iam::123456789012:role/ci, aws-region: us-east-1} - uses: andrey-usa/compara@v0 with: a: s3://lake/orders/baseline.parquet b: out/orders.parquet key: order_id,line_no args: -i updated_at --tolerance 0.01 report: out/orders-diff.html ``` Its outputs are `identical`, `changed`, `added`, `removed` and `summary` (the JSON summary's path). A Kubernetes Job comparing two Parquet snapshots with the pod's IAM role (IRSA), its summary written next to the data; without `--exit-zero` the Job fails when they differ: ```yaml apiVersion: batch/v1 kind: Job metadata: {name: orders-diff} spec: backoffLimit: 0 template: spec: serviceAccountName: lake-reader # annotated with the IAM role restartPolicy: Never containers: - name: compara image: ghcr.io/andrey-usa/compara:latest args: [compare, s3://lake/orders/v1.parquet, s3://lake/orders/v2.parquet, -k, order_id, --json, s3://reports/orders/summary.json, --exit-zero] resources: {limits: {memory: 2Gi, cpu: "4"}} securityContext: {readOnlyRootFilesystem: true, runAsNonRoot: true} volumeMounts: [{name: tmp, mountPath: /tmp}] volumes: [{name: tmp, emptyDir: {}}] ``` --- Made from [docs/guides/containers.md](https://github.com/andrey-usa/compara/blob/main/docs/guides/containers.md). # Name a recurring comparison Give a comparison you run often a name in compara.toml, and the example pair the repository ships. ## A named profile (`compara.example.toml`) A recurring comparison gets a name in `compara.toml`; every field is optional and the command line overrides the profile. ```toml {{#include ../../../compara.example.toml}} ``` ## The shipped example pair `examples/` in the repo holds two monthly order exports and the report made from them (`examples/report.html`): ```sh compara compare examples/orders_2026-08.csv examples/orders_2026-09.csv \ -k order_id,line_no -i updated_at -o report.html ``` First rows of `orders_2026-08.csv`: ```csv {{#include ../../../examples/orders_2026-08.csv:1:5}} ``` First rows of `orders_2026-09.csv` (note the extra `carrier` column and the changed `status` values): ```csv {{#include ../../../examples/orders_2026-09.csv:1:5}} ``` --- Made from [docs/examples.md](https://github.com/andrey-usa/compara/blob/main/docs/examples.md). # Engines and formats The three engines and their shared result contract, and how each input format is read. Three backends, one result contract: every engine returns identical counts and column statistics for the same input, and the test suite asserts it cell for cell. `--engine auto` takes the first one that can load the input, in this order. | Engine | Implementation | Memory model | Use it for | |---|---|---|---| | `turbo` | mapped file, byte-level index; CSV, JSON and Parquet | off-heap bytes, index in memory | the default, and the fastest | | `sortmerge` | external sort, merge join | bounded memory, spills to disk | files past what memory can index | | `native` | over the `csv` crate | in-memory, row-oriented | the dependency-light baseline | All three read values as text, with no type inference, so `1.0` and `1` stay different unless a tolerance is set, and all three treat an empty field as absent whether or not it is quoted. A Parquet column is the exception, on either side: it stores typed values, so a column it holds as numbers compares by value with the other file's text (`31.40` against the DOUBLE 31.4 is no change), and a date, time or timestamp column by instant (`T` or a space, a zero fraction or none, `Z` or nothing). ## Input formats `turbo` decides what a file is by its content rather than its name: a Parquet magic number, a leading `{` or `[`, or a CSV header. | Format | How it is read | |---|---| | CSV | mapped, scanned eight bytes at a time; a field is an offset and a length; a UTF-8 byte order mark is skipped; the separator (comma, semicolon, tab or pipe) is read from the header line unless `--delimiter` names it | | TSV | the CSV reader with a tab for the separator, found in the header line like any other; the same rows as TSV and as CSV give the same answer and the same export | | JSON | one object per line (NDJSON), one top-level array of objects, or objects one after another (`jq .`), with only space and a comma between two of them; a line break inside a string of NDJSON is refused (JSON writes it `\n`); the columns are the keys of every object, in the order the file first shows them, so a field a writer leaves out of its first row is still a column; a value is found by its key rather than its position, and a key is the name its escapes spell (`"caf\u00e9"` is `café`); `\uXXXX` is decoded, so an escaped and a literal character compare equal; `null` and a missing key are both absent; a name repeated in one object takes its last value, `null` included, key column or not; a name that is not UTF-8 is refused | | Parquet | pages decoded into an arena; dictionary-encoded columns point at the dictionary entry, so a repeated value costs eight bytes a row | **CSV as files have it.** Every engine reads a CSV file the same way, the files that are not quite CSV included. A quote means something only as the first byte of a field, so `5" nail` is the text it looks like. Text after a closing quote stays in the value: `"ab"cd` is `abcd`. A quote that is never closed takes the rest of the file as its field. Lines end in a line feed, with or without a carriage return before it. A file whose lines end in a carriage return alone (the classic Mac ending, Excel's "CSV (Macintosh)") is read by `sortmerge` and `native`: `auto` compares it with one of them and says so, and `--engine turbo` declines it. **Nested JSON.** A value that is an object or an array is compared as its JSON text: any difference inside it is a change to that column, and the report and export show the text. The space between its tokens is not part of it, and a string's characters are read however they are escaped (`\u00e9` or `é`, `\/` or `/`), so the same records written pretty or compact, by `jq` or by Python, are the same table. The order of an object's keys and the spelling of a number (`1.0`, `1`) are as written, as a top-level number's is: the same object with its keys in another order is a change. To compare those by value, flatten nested values into top-level keys first (`jq`, or the writer's own option), and each nested field becomes a column compared on its own. The Parquet reader is written here rather than taken from a crate, to keep that representation instead of converting to Arrow arrays. It reads PLAIN, dictionary (`PLAIN_DICTIONARY`, `RLE_DICTIONARY`), RLE booleans and the version-2 delta encodings; uncompressed, snappy, gzip, zstd and LZ4-raw pages; data pages v1 and v2; definition levels for optional columns. It refuses, by name, nested or repeated schemas, `BYTE_STREAM_SPLIT`, LZO and Brotli. A typed Parquet value is rendered to text by a fixed rule: byte arrays as their bytes, booleans `true`/`false`, integers and decimals in full, floats in the shortest round-trip form, dates `YYYY-MM-DD`, timestamps ISO 8601. `tests/fixtures/formats/typed.csv` is that rule written down. Two Parquet files take a columnar path instead, which never builds a row: it joins on the key columns, then compares one column at a time, string columns by dictionary id or bytes and booleans, integers, floats, dates, times, timestamps and decimals of up to eight bytes as one word per value. A cell is rendered by the rule above only when the report shows it or `--export-dir` lists it. Added and removed rows are known from the join, so their cells are written out during that pass; which rows changed is known only after the last column, so an export reads the compared columns once more and writes out just those rows. It costs that second pass and the text it writes, rather than holding every column of both files at once. A column the two files store as different types, or with an encoding or page outside PLAIN, dictionary and v1 pages (or LZO or Brotli compression), goes the row-by-row way instead, with the same answer. --- Made from [docs/engines.md](https://github.com/andrey-usa/compara/blob/main/docs/engines.md). # compare options Every option of compare, duplicate keys and profiles. | Option | Effect | |---|---| | `-k`, `--key` | composite key, required (or from a profile) | | `-c`, `--compare` | columns to diff; default every column present in both files except the key | | `-i`, `--ignore` | columns to skip (timestamps, run ids) | | `--trim`, `--ignore-case` | normalisation before comparing (applies to key and values); a value `--trim` leaves empty is absent, as an empty cell is, so `" "` against an empty or missing value is no change | | `--empty-is-null` | kept for old scripts and profiles: an empty value and a missing one are always equal, in every format | | `--tolerance` | absolute numeric tolerance where both sides parse as numbers | | `--delimiter` | override delimiter detection (CSV only): one character, or `'\t'` (or `tab`) for a tab; one that isn't in a file's header is noted | | `--encoding` | UTF-8 (the default) is read as text; Latin-1 or a Windows code page compares as bytes, with the right counts; UTF-16 and UTF-32 are refused with how to convert | | `--threads` | how wide the engines run; the default is every core | | `--memory` | memory to plan for (e.g. `8G`); decides when large text files are joined in one pass instead of two, and how many columns of two Parquet files are read at once (a Parquet pair that needs more than a stated budget is refused) | | `--max-rows` | rows embedded per report section (default 50 000) | | `-o`, `--out` | write the HTML report here, or to standard output with `-o -`; there is no report without it | | `--export-dir` | full, uncapped changed/added/removed CSVs | | `--json` | write a JSON summary (counts and column stats; schema in `docs/contract.schema.json`) | | `--summary` | print the counts and refuse any flag that writes a file (the default without `-o`, `--json` or `--export-dir`) | | `--engine` | `auto` (default), `turbo`, `sortmerge` or `native`; `sortmerge` and `native` read CSV only | | `--no-compress` | plain JSON payload in the report, for pre-2023 browsers (with `-o`) | | `--fail-on-dups` | exit 3 when either file has duplicate keys | | `--exit-zero` | exit 0 when the tables differ: for a scheduled job whose output is the report (a Kubernetes Job, an Airflow task) | An option that names columns (`-k`, `-c`, `-i`) may be given more than once, and the names add up: `-k order_id -k line_no` is `-k order_id,line_no`. Any other option given twice with two values is refused. A column that only one of the two files has is not compared, and the exit code does not answer for it: a note after the counts names it (`note: column only in B, not compared: carrier`), unless `-i` names the column or `-c` names the ones to compare, and the JSON summary lists such columns as `meta.only_in_a` and `meta.only_in_b`. Duplicate keys are counted and listed per file; the first occurrence of each key takes part in the join. **Profiles.** A `compara.toml` in the working directory (or `~/.config/compara/compara.toml`, or `--config PATH`) names recurring comparisons: key, compared and ignored columns, normalisation, engine. See [`compara.example.toml`](https://github.com/andrey-usa/compara/blob/main/compara.example.toml). The command line overrides the profile. A list may run over several lines. A key a profile does not have, or a value of the wrong kind (`trim = yes`), is refused with its line, and a profile name that is not in the file is answered with the names that are. --- Made from [docs/options.md](https://github.com/andrey-usa/compara/blob/main/docs/options.md). # The JSON summary The shape of the summary `--json` writes, as a JSON Schema. `compare --json PATH` writes the counts and per-column statistics of a comparison as one JSON document (`--json -` prints it on standard output and the counts on standard error). `counts` and `columns` are the same from every engine on the same input; `meta` says how this run went. The shape, as a JSON Schema: ```json {{#include ../../../docs/contract.schema.json}} ``` --- Made from [docs/json-summary.md](https://github.com/andrey-usa/compara/blob/main/docs/json-summary.md). # compara --help The commands and options exactly as this build prints them. ```text $ compara --help usage: compara [options] commands: compare A B Compare two tables on a composite key and print the counts; with -o, also write an HTML report columns FILE Print one file's column names, one per line head FILE Print the first rows of one file (default 10) version Print the version (also --version) env Print what this process sees: CPUs, memory and its limits, the temporary directory, and whether URLs can be read skill Print the agent skill: how an agent uses compara A, B and FILE are paths, `-` for standard input, or with cloud support s3://, gs://, az:// and https:// URLs. Gzip and zstd files are read as what they hold. A directory, a quoted glob ('out/date=*/*.parquet', `**` for any depth) or an object storage prefix (s3://bucket/orders/) is its files read as one table, in path order; names starting with `.` or `_` in a directory are passed over, and Hive partition directories (date=2026-10-01/) are columns. A Delta table is read at its latest version, or at TABLE@vN (s3://lake/orders@v41). columns and head read CSV, newline-delimited JSON and Parquet, and neither reads more of the file than it has to: `columns` on Parquet reads the footer, and `head` stops at the first page. Both take --delimiter. head options: -n, --rows N Rows to show (default 10) --csv Print as CSV instead of an aligned table compare options: -k, --key COLS Comma-separated key column(s) (or from --profile) -c, --compare COLS Columns to compare (default: every common non-key column) -i, --ignore COLS Columns to skip -p, --profile NAME Profile name from compara.toml --config PATH Path to compara.toml --trim Strip whitespace before comparing --ignore-case Compare text without regard to case --empty-is-null Kept for old scripts: an empty value and a missing one are always equal (and with --trim, one of spaces) --tolerance N Absolute numeric tolerance --max-rows N Rows embedded per report section (default 50000) --delimiter D Force the delimiter: one character, or '\t' for a tab (default: detected) --encoding ENC UTF-8 (the default) is read as text; Latin-1 or a Windows code page compares as bytes (right counts); UTF-16 is refused --engine E auto (default) picks one: turbo, in memory and the fastest; sortmerge, which sorts on disk for files larger than memory; native, the simple baseline. sortmerge and native read CSV only --threads N Threads to use (default: every core, or the container's CPU quota) --memory SIZE Memory to plan for, e.g. 8G (default: what the machine or container has free); decides when large text files are joined in one pass instead of two, and how many columns of two Parquet files are read at once; Parquet that needs more than SIZE one column at a time is refused --export-dir DIR Write full changed, added and removed CSVs here (a directory, or a URL prefix such as s3://bucket/run/) -o, --out PATH Write the HTML report here, a path or a URL, or `-` for standard output (no report without it) --json PATH Write a JSON summary (counts and column statistics) here, a path or a URL; `-` prints it, and the counts line goes to stderr --no-compress Report: embed plain JSON instead of gzip (for older browsers) --summary Print the counts, write nothing, and refuse any flag that would (the default without -o, --json or --export-dir) --fail-on-dups Exit 3 when either file has duplicate keys --exit-zero Exit 0 when the tables differ: for a scheduled job whose output is the report, where a difference is not a failure (a Kubernetes Job, an Airflow task) Exit codes: 0 identical, 1 differences found, 2 error, 3 duplicate keys (with --fail-on-dups). ``` --- Made from `compara --help`. # For AI agents What an agent gets: a JSON result, exit codes it can branch on, a read-only default, and these docs as markdown. - **Skill:** `compara skill` prints the guide an agent reads to use this version of compara. - **Machine-readable result:** `--json summary.json` (or `--json -` for standard output) writes the counts and per-column statistics, in the shape [docs/contract.schema.json](https://github.com/andrey-usa/compara/blob/main/docs/contract.schema.json) gives. - **Exit codes:** `0` identical, `1` differences, `2` error, `3` duplicate keys with `--fail-on-dups`; `--exit-zero` for a job whose output is the report. - **Read-only by default:** `compare` without `-o`, `--json` or `--export-dir` writes nothing; `--summary` makes that a promise and refuses any flag that would write. - **Docs as markdown:** [llms.txt](../llms.txt) lists every page of the docs site, each one also served as `.md`. The loop an agent runs: `compara columns` on each file to choose the key, `compare --summary` for the counts, then `--json -` for the columns that changed and `--export-dir` for the rows. --- Made from [README.md](https://github.com/andrey-usa/compara/blob/main/README.md). # Skill The guide `compara skill` gives an agent, as this version prints it. One native binary. It reads both tables, joins them on the key you name and says what differs, in about a second for ten million rows. ## The loop 1. Find the key: `compara columns a.csv` prints the column names (on Parquet it reads only the footer); `compara head a.csv -n 5` shows the first rows. 2. Count: `compara compare a.csv b.csv -k id` prints one line of counts and writes nothing. Exit code `0`: identical; `1`: they differ; `2`: an error (its message says what to change); `3`: duplicate keys, with `--fail-on-dups`. 3. See which columns changed: `--json -` prints the summary as JSON on standard output (counts on standard error). `columns[].changed` counts the rows each column changed in; `counts` has `unchanged`, `changed`, `added`, `removed` and the duplicate keys of each side. 4. See the rows: `--export-dir out/` writes the changed, added and removed rows as CSVs, uncapped; `-o report.html` writes a report a person can open. ```sh compara compare a.csv b.csv -k account_id,txn_id -i updated_at --json - ``` ## Options that change the answer | option | use it when | |---|---| | `-k a,b` | the key is several columns: always name all of them | | `-i col,col` | a column always differs (load time, run id) | | `-c col,col` | only some columns matter | | `--tolerance 0.005` | numbers may differ by rounding; without it `1.0` and `1` differ in CSV | | `--trim`, `--ignore-case` | whitespace or case should not count; under `--trim` a cell of only spaces equals an empty or missing one | | `--delimiter ';'` | the separator is not found from the header (`'\t'` for a tab) | | `--encoding latin1` | the file is not UTF-8 | A column only one file has is not compared and does not change the exit code: a note on standard error names it, and the JSON lists such columns as `meta.only_in_a` and `meta.only_in_b`. Values compare as text in CSV and JSON; a Parquet column that holds numbers or dates compares by value. A key that appears twice in a file is counted under the duplicate keys, and its first row takes part in the join. ## Safe by default `compare` writes only what `-o`, `--json` or `--export-dir` name; `--summary` refuses those, for a run that must only read. `--exit-zero` exits `0` even when the tables differ, for a job whose output is the report. ## Files that are not local Any file argument can be a URL: `s3://bucket/key.parquet`, `gs://`, `az://`, `https://`. Credentials come from each cloud's own environment variables or profiles; with none, a public bucket is read unsigned. A directory, a quoted glob or a prefix is its files read as one table; `s3://lake/orders@v41` is version 41 of a Delta table. ## When something fails Read the error: it names the file, the column or the option, and what to do (a key column missing from one side lists the columns it has). `compara env` prints the CPUs, the memory limit and the temporary directory it sees. --- Made from [skills/compara/SKILL.md](https://github.com/andrey-usa/compara/blob/main/skills/compara/SKILL.md). # Results compara against DuckDB and Polars on the same comparisons, local and on object storage, each number with its CI run. Numbers: [bench-contenders run 45112799027](https://github.com/andrey-usa/compara/actions/runs/45112799027), 2026-11-23. Two tables of 20 columns compared on a composite key (`-k account_id,txn_id -i updated_at`), every tool's unchanged, changed, added and removed counts checked identical. Run on GitHub's `ubuntu-24.04, image 20261116.376.1`: AMD EPYC 7763 64-Core Processor, 4 cores, 15 GB, Linux-7.0.0-1017-azure-x86_64-with-glibc2.39. | input, both files | compara 0.8.0 | DuckDB 2.0.1 | Polars 2.1.0 | qsv 29.0.0 | ClickHouse 26.9.36.3 | |---|---|---|---|---|---| | 1M rows, CSV, 368 MB | **0.12 s (0.12-0.15)** · cold 0.69 s (0.68-0.71) · 0.3 s · 411 MB (56 private) | 1.27 s (1.26-1.29) · cold 1.30 s (1.28-1.67) · 4.1 s · 671 MB (608 private) | 0.93 s (0.92-0.93) · cold 1.38 s (1.34-2.15) · 3.6 s · 1,431 MB (1,370 private) | 0.91 s (0.90-1.11) · cold 1.12 s (1.08-1.13) · 2.4 s · 135 MB (105 private) | 1.49 s (1.46-1.89) · cold 1.59 s (1.58-1.73) · 4.5 s · 1,300 MB (948 private) | | 1M rows, Parquet by compara-gen-data, 161 MB | **0.15 s (0.15-0.16)** · cold 0.25 s (0.24-0.25) · 0.4 s · 323 MB (165 private) | 1.16 s (1.11-1.18) · cold 1.20 s (1.16-1.21) · 1.4 s · 761 MB (701 private) | 0.62 s (0.61-0.64) · cold 0.67 s (0.66-0.70) · 2.2 s · 1,635 MB (1,568 private) | not run | 0.83 s (0.83-0.86) · cold 0.94 s (0.93-0.99) · 2.0 s · 1,036 MB (783 private) | | 1M rows, Parquet by Polars, 61 MB | **0.26 s (0.25-0.26)** · cold 0.29 s (0.28-0.31) · 0.8 s · 362 MB (301 private) | 0.55 s (0.54-0.57) · cold 0.55 s (0.55-0.57) · 2.1 s · 568 MB (508 private) | 0.50 s (0.49-0.51) · cold 0.54 s (0.53-0.55) · 2.0 s · 1,115 MB (1,044 private) | not run | 0.89 s (0.86-0.91) · cold 0.89 s (0.88-0.91) · 2.2 s · 951 MB (724 private) | | 1M rows, Parquet by DuckDB, 97 MB | **0.22 s (0.22-0.23)** · cold 0.28 s (0.27-0.28) · 0.7 s · 384 MB (288 private) | 0.47 s (0.46-0.47) · cold 0.48 s (0.48-0.49) · 1.7 s · 533 MB (474 private) | 0.43 s (0.41-0.44) · cold 0.47 s (0.47-0.48) · 1.8 s · 1,015 MB (944 private) | not run | 0.79 s (0.76-0.80) · cold 0.83 s (0.80-0.86) · 2.0 s · 990 MB (756 private) | | 10M rows, CSV, 3,679 MB | **0.94 s (0.94-0.95)** · cold 9.32 s (9.30-9.33) · 3.1 s · 4,030 MB (511 private) | 9.87 s (9.81-9.89) · cold 10.19 s (10.16-10.23) · 37.1 s · 4,240 MB (4,178 private) | 9.75 s (9.67-9.99) · cold 13.37 s (13.25-13.56) · 35.7 s · 9,880 MB (9,816 private) | 11.72 s (10.07-11.96) · cold 10.76 s (10.38-12.29) · 27.8 s · 2,123 MB (2,096 private) | 30.04 s (29.88-30.26) · cold 29.97 s (29.77-30.30) · 75.8 s · 7,662 MB (5,986 private) | | 10M rows, Parquet by compara-gen-data, 1,609 MB | **1.16 s (1.14-1.17)** · cold 4.03 s (4.00-4.05) · 3.8 s · 2,776 MB (1,261 private) | 4.93 s (4.87-5.13) · cold 5.91 s (5.79-6.04) · 17.3 s · 5,044 MB (4,997 private) | 5.97 s (5.87-5.99) · cold 7.67 s (7.50-7.77) · 19.2 s · 10,760 MB (10,723 private) | not run | 23.82 s (23.52-23.98) · cold 23.99 s (23.84-24.21) · 51.6 s · 7,102 MB (6,157 private) | | 10M rows, Parquet by Polars, 609 MB | **2.24 s (2.22-2.43)** · cold 2.57 s (2.53-2.59) · 7.8 s · 3,138 MB (2,551 private) | 4.74 s (4.70-4.81) · cold 4.80 s (4.72-4.84) · 18.4 s · 3,572 MB (3,525 private) | 5.39 s (5.28-5.42) · cold 5.82 s (5.76-5.86) · 20.4 s · 9,084 MB (9,039 private) | not run | 23.39 s (23.27-23.56) · cold 23.47 s (23.33-23.82) · 49.3 s · 6,708 MB (6,212 private) | | 10M rows, Parquet by DuckDB, 964 MB | **1.73 s (1.72-1.74)** · cold 2.69 s (2.67-2.73) · 5.9 s · 3,589 MB (2,664 private) | 3.93 s (3.91-3.95) · cold 3.95 s (3.92-4.00) · 15.2 s · 3,417 MB (3,370 private) | 4.66 s (4.63-4.79) · cold 5.47 s (5.39-5.51) · 17.8 s · 8,534 MB (8,491 private) | not run | 22.88 s (22.82-23.12) · cold 23.20 s (23.03-23.26) · 47.1 s · 6,504 MB (5,849 private) | Where a file repeats 0.01% of its keys, each compared by its first row: | input, both files | compara 0.8.0 | DuckDB 2.0.1 | Polars 2.1.0 | qsv 29.0.0 | |---|---|---|---|---| | 1M rows, CSV, repeated keys, 368 MB | **0.12 s (0.12-0.12)** · cold 0.70 s (0.69-0.74) · 0.3 s · 411 MB (56 private) | 3.16 s (3.15-3.18) · cold 3.15 s (3.14-3.16) · 8.6 s · 1,111 MB (1,051 private) | 3.21 s (3.17-3.31) · cold 3.45 s (3.25-3.50) · 12.0 s · 2,096 MB (2,035 private) | 0.92 s (0.90-1.08) · cold 1.12 s (0.92-1.14) · 2.3 s · 222 MB (191 private) | | 1M rows, Parquet by compara-gen-data, repeated keys, 161 MB | **0.15 s (0.15-0.17)** · cold 0.25 s (0.25-0.26) · 0.4 s · 339 MB (181 private) | 1.74 s (1.70-1.79) · cold 1.78 s (1.74-1.81) · 2.7 s · 1,226 MB (1,166 private) | 3.33 s (3.27-3.38) · cold 3.41 s (3.36-3.47) · 10.8 s · 2,206 MB (2,139 private) | not run | | 10M rows, CSV, repeated keys, 3,679 MB | **0.94 s (0.94-0.98)** · cold 9.30 s (9.30-9.33) · 3.1 s · 4,031 MB (511 private) | 24.84 s (24.49-24.93) · cold 24.92 s (24.55-25.01) · 88.5 s · 8,742 MB (8,692 private) | out of memory after 17 s, at 13,319 MB | 10.66 s (9.87-12.55) · cold 11.05 s (10.85-12.41) · 26.3 s · 1,418 MB (1,391 private) | | 10M rows, Parquet by compara-gen-data, repeated keys, 1,609 MB | **1.16 s (1.13-1.17)** · cold 4.04 s (4.02-4.05) · 3.7 s · 2,855 MB (1,340 private) | 9.87 s (9.66-9.93) · cold 10.39 s (10.22-10.76) · 34.3 s · 6,880 MB (6,827 private) | out of memory after 74 s, at 13,291 MB | not run | Each cell: wall time from a warm page cache, median of 5 runs (fastest-slowest in brackets) · CPU time (user and system) · peak memory (RSS, and in brackets the private part of it), of the median run; fastest median in bold. Every run starts from a stated page cache: warm (its inputs read to the end just before) is the first figure, cold (its inputs dropped from the page cache, so read from the disk) the second. DuckDB and Polars run from Python, and their time starts at their first read, after the interpreter's start and the import; qsv and ClickHouse are binaries timed as a whole process, like compara. qsv reads CSV only and is given the files with the ignored column already taken out (and, where keys repeat, each key's first row only), untimed (the page says how). ClickHouse (clickhouse-local) runs on the pairs with unique keys. The tools run in a different order each round. A tool the runner's kernel stopped for lack of memory says so. Reading both inputs from a cold cache alone took (median): 1M rows, CSV, 368 MB 0.59 s; 1M rows, Parquet by compara-gen-data, 161 MB 0.11 s; 1M rows, Parquet by Polars, 61 MB 0.02 s; 1M rows, Parquet by DuckDB, 97 MB 0.03 s; 1M rows, CSV, repeated keys, 368 MB 0.60 s; 1M rows, Parquet by compara-gen-data, repeated keys, 161 MB 0.10 s; 10M rows, CSV, 3,679 MB 8.64 s; 10M rows, Parquet by compara-gen-data, 1,609 MB 3.60 s; 10M rows, Parquet by Polars, 609 MB 1.18 s; 10M rows, Parquet by DuckDB, 964 MB 2.05 s; 10M rows, CSV, repeated keys, 3,679 MB 8.63 s; 10M rows, Parquet by compara-gen-data, repeated keys, 1,609 MB 3.61 s. ## Every run The runs go round the tools in turn (5 rounds, each tool once in each page-cache state per round: warm, cold, the order turned by one tool each round), so a slow minute on the runner falls on all of them. | input | tool | page cache | every run: wall · CPU · peak memory · major page faults | |---|---|---|---| | 1M rows, CSV, 368 MB | compara | warm | 0.12 s · 0.3 s · 411 MB (56 private) · 0 major faults; 0.15 s · 0.3 s · 411 MB (56 private) · 0 major faults; 0.12 s · 0.3 s · 411 MB (56 private) · 0 major faults; 0.12 s · 0.3 s · 411 MB (56 private) · 0 major faults; 0.12 s · 0.3 s · 411 MB (56 private) · 0 major faults | | 1M rows, CSV, 368 MB | compara | cold | 0.71 s · 0.4 s · 411 MB (56 private) · 1,404 major faults; 0.68 s · 0.4 s · 411 MB (56 private) · 1,404 major faults; 0.69 s · 0.4 s · 411 MB (56 private) · 1,404 major faults; 0.71 s · 0.4 s · 411 MB (56 private) · 1,404 major faults; 0.69 s · 0.4 s · 411 MB (56 private) · 1,404 major faults | | 1M rows, CSV, 368 MB | DuckDB | warm | 1.29 s · 4.0 s · 658 MB (594 private) · 0 major faults; 1.28 s · 4.0 s · 655 MB (592 private) · 0 major faults; 1.26 s · 4.1 s · 679 MB (616 private) · 0 major faults; 1.27 s · 4.1 s · 671 MB (608 private) · 0 major faults; 1.26 s · 4.1 s · 679 MB (617 private) · 0 major faults | | 1M rows, CSV, 368 MB | DuckDB | cold | 1.28 s · 4.1 s · 657 MB (594 private) · 0 major faults; 1.67 s · 4.2 s · 740 MB (677 private) · 0 major faults; 1.28 s · 4.1 s · 688 MB (626 private) · 0 major faults; 1.30 s · 4.1 s · 688 MB (625 private) · 0 major faults; 1.30 s · 4.1 s · 656 MB (594 private) · 0 major faults | | 1M rows, CSV, 368 MB | Polars | warm | 0.92 s · 3.6 s · 1,439 MB (1,374 private) · 0 major faults; 0.93 s · 3.6 s · 1,439 MB (1,374 private) · 0 major faults; 0.92 s · 3.6 s · 1,445 MB (1,380 private) · 0 major faults; 0.93 s · 3.6 s · 1,431 MB (1,367 private) · 0 major faults; 0.93 s · 3.6 s · 1,431 MB (1,370 private) · 0 major faults | | 1M rows, CSV, 368 MB | Polars | cold | 1.38 s · 3.6 s · 1,432 MB (1,371 private) · 2 major faults; 2.15 s · 3.7 s · 1,379 MB (1,313 private) · 2 major faults; 1.40 s · 3.7 s · 1,346 MB (1,282 private) · 2 major faults; 1.36 s · 3.7 s · 1,409 MB (1,344 private) · 2 major faults; 1.34 s · 3.7 s · 1,407 MB (1,342 private) · 2 major faults | | 1M rows, CSV, 368 MB | qsv | warm | 0.91 s · 2.4 s · 133 MB (103 private) · 0 major faults; 1.11 s · 2.7 s · 305 MB (280 private) · 0 major faults; 0.91 s · 2.4 s · 135 MB (105 private) · 0 major faults; 0.90 s · 2.3 s · 230 MB (200 private) · 0 major faults; 1.08 s · 2.6 s · 342 MB (312 private) · 0 major faults | | 1M rows, CSV, 368 MB | qsv | cold | 1.08 s · 2.6 s · 281 MB (250 private) · 0 major faults; 1.12 s · 2.7 s · 335 MB (304 private) · 0 major faults; 1.09 s · 2.6 s · 315 MB (284 private) · 0 major faults; 1.13 s · 2.7 s · 323 MB (293 private) · 0 major faults; 1.13 s · 2.7 s · 339 MB (309 private) · 0 major faults | | 1M rows, CSV, 368 MB | ClickHouse | warm | 1.46 s · 4.5 s · 1,300 MB (949 private) · 0 major faults; 1.89 s · 4.6 s · 1,352 MB (1,004 private) · 0 major faults; 1.49 s · 4.5 s · 1,300 MB (948 private) · 0 major faults; 1.49 s · 4.6 s · 1,323 MB (981 private) · 0 major faults; 1.49 s · 4.5 s · 1,306 MB (967 private) · 0 major faults | | 1M rows, CSV, 368 MB | ClickHouse | cold | 1.58 s · 4.6 s · 1,304 MB (957 private) · 2 major faults; 1.61 s · 4.6 s · 1,306 MB (954 private) · 2 major faults; 1.73 s · 4.6 s · 1,231 MB (879 private) · 2 major faults; 1.58 s · 4.6 s · 1,298 MB (947 private) · 2 major faults; 1.59 s · 4.6 s · 1,272 MB (922 private) · 2 major faults | | 1M rows, Parquet by compara-gen-data, 161 MB | compara | warm | 0.15 s · 0.4 s · 323 MB (165 private) · 0 major faults; 0.16 s · 0.4 s · 323 MB (165 private) · 0 major faults; 0.15 s · 0.4 s · 323 MB (165 private) · 0 major faults; 0.15 s · 0.4 s · 323 MB (165 private) · 0 major faults; 0.15 s · 0.4 s · 323 MB (165 private) · 0 major faults | | 1M rows, Parquet by compara-gen-data, 161 MB | compara | cold | 0.25 s · 0.5 s · 321 MB (165 private) · 410 major faults; 0.24 s · 0.5 s · 321 MB (165 private) · 407 major faults; 0.25 s · 0.5 s · 322 MB (165 private) · 400 major faults; 0.25 s · 0.5 s · 322 MB (165 private) · 417 major faults; 0.24 s · 0.5 s · 320 MB (165 private) · 421 major faults | | 1M rows, Parquet by compara-gen-data, 161 MB | DuckDB | warm | 1.18 s · 1.4 s · 761 MB (701 private) · 0 major faults; 1.11 s · 1.3 s · 605 MB (546 private) · 0 major faults; 1.18 s · 1.4 s · 744 MB (685 private) · 0 major faults; 1.14 s · 1.3 s · 684 MB (625 private) · 0 major faults; 1.16 s · 1.4 s · 761 MB (701 private) · 0 major faults | | 1M rows, Parquet by compara-gen-data, 161 MB | DuckDB | cold | 1.20 s · 1.4 s · 761 MB (701 private) · 0 major faults; 1.20 s · 1.4 s · 761 MB (701 private) · 0 major faults; 1.17 s · 1.4 s · 666 MB (607 private) · 0 major faults; 1.16 s · 1.3 s · 684 MB (624 private) · 0 major faults; 1.21 s · 1.4 s · 743 MB (684 private) · 0 major faults | | 1M rows, Parquet by compara-gen-data, 161 MB | Polars | warm | 0.62 s · 2.2 s · 1,622 MB (1,554 private) · 0 major faults; 0.62 s · 2.2 s · 1,635 MB (1,568 private) · 0 major faults; 0.61 s · 2.2 s · 1,636 MB (1,569 private) · 0 major faults; 0.61 s · 2.2 s · 1,623 MB (1,556 private) · 0 major faults; 0.64 s · 2.1 s · 1,624 MB (1,557 private) · 0 major faults | | 1M rows, Parquet by compara-gen-data, 161 MB | Polars | cold | 0.68 s · 2.3 s · 1,701 MB (1,633 private) · 2 major faults; 0.66 s · 2.3 s · 1,691 MB (1,623 private) · 2 major faults; 0.66 s · 2.2 s · 1,706 MB (1,639 private) · 2 major faults; 0.67 s · 2.3 s · 1,716 MB (1,649 private) · 2 major faults; 0.70 s · 2.2 s · 1,695 MB (1,627 private) · 2 major faults | | 1M rows, Parquet by compara-gen-data, 161 MB | ClickHouse | warm | 0.83 s · 2.0 s · 1,040 MB (787 private) · 0 major faults; 0.83 s · 2.0 s · 1,036 MB (783 private) · 0 major faults; 0.86 s · 2.1 s · 1,058 MB (809 private) · 0 major faults; 0.84 s · 2.1 s · 1,036 MB (786 private) · 0 major faults; 0.83 s · 2.0 s · 1,028 MB (775 private) · 0 major faults | | 1M rows, Parquet by compara-gen-data, 161 MB | ClickHouse | cold | 0.95 s · 2.1 s · 1,052 MB (801 private) · 552 major faults; 0.93 s · 2.1 s · 1,059 MB (806 private) · 580 major faults; 0.99 s · 2.1 s · 1,090 MB (839 private) · 563 major faults; 0.94 s · 2.1 s · 1,115 MB (866 private) · 565 major faults; 0.93 s · 2.0 s · 1,049 MB (795 private) · 573 major faults | | 1M rows, Parquet by Polars, 61 MB | compara | warm | 0.26 s · 0.8 s · 362 MB (302 private) · 0 major faults; 0.25 s · 0.8 s · 359 MB (300 private) · 0 major faults; 0.26 s · 0.8 s · 362 MB (301 private) · 0 major faults; 0.26 s · 0.8 s · 361 MB (302 private) · 0 major faults; 0.25 s · 0.8 s · 362 MB (301 private) · 0 major faults | | 1M rows, Parquet by Polars, 61 MB | compara | cold | 0.31 s · 0.8 s · 343 MB (302 private) · 297 major faults; 0.28 s · 0.8 s · 343 MB (302 private) · 309 major faults; 0.29 s · 0.8 s · 342 MB (302 private) · 300 major faults; 0.29 s · 0.8 s · 343 MB (302 private) · 299 major faults; 0.29 s · 0.8 s · 344 MB (302 private) · 291 major faults | | 1M rows, Parquet by Polars, 61 MB | DuckDB | warm | 0.54 s · 2.0 s · 563 MB (503 private) · 0 major faults; 0.57 s · 2.0 s · 569 MB (508 private) · 0 major faults; 0.55 s · 2.1 s · 567 MB (507 private) · 0 major faults; 0.56 s · 2.0 s · 562 MB (502 private) · 0 major faults; 0.55 s · 2.1 s · 568 MB (508 private) · 0 major faults | | 1M rows, Parquet by Polars, 61 MB | DuckDB | cold | 0.55 s · 2.0 s · 562 MB (502 private) · 0 major faults; 0.56 s · 2.1 s · 568 MB (509 private) · 0 major faults; 0.55 s · 2.1 s · 566 MB (506 private) · 0 major faults; 0.57 s · 2.1 s · 564 MB (505 private) · 0 major faults; 0.55 s · 2.0 s · 568 MB (508 private) · 0 major faults | | 1M rows, Parquet by Polars, 61 MB | Polars | warm | 0.51 s · 2.1 s · 1,118 MB (1,048 private) · 0 major faults; 0.50 s · 2.0 s · 1,100 MB (1,029 private) · 0 major faults; 0.50 s · 2.1 s · 1,117 MB (1,046 private) · 0 major faults; 0.49 s · 2.1 s · 1,090 MB (1,019 private) · 0 major faults; 0.50 s · 2.0 s · 1,115 MB (1,044 private) · 0 major faults | | 1M rows, Parquet by Polars, 61 MB | Polars | cold | 0.54 s · 2.1 s · 1,146 MB (1,075 private) · 2 major faults; 0.55 s · 2.1 s · 1,135 MB (1,066 private) · 2 major faults; 0.53 s · 2.1 s · 1,157 MB (1,086 private) · 2 major faults; 0.55 s · 2.2 s · 1,189 MB (1,119 private) · 2 major faults; 0.53 s · 2.1 s · 1,141 MB (1,070 private) · 2 major faults | | 1M rows, Parquet by Polars, 61 MB | ClickHouse | warm | 0.87 s · 2.2 s · 921 MB (694 private) · 0 major faults; 0.86 s · 2.2 s · 959 MB (733 private) · 0 major faults; 0.89 s · 2.2 s · 951 MB (724 private) · 0 major faults; 0.90 s · 2.3 s · 983 MB (758 private) · 0 major faults; 0.91 s · 2.2 s · 951 MB (732 private) · 0 major faults | | 1M rows, Parquet by Polars, 61 MB | ClickHouse | cold | 0.89 s · 2.2 s · 932 MB (710 private) · 247 major faults; 0.89 s · 2.2 s · 943 MB (717 private) · 289 major faults; 0.88 s · 2.2 s · 921 MB (696 private) · 263 major faults; 0.89 s · 2.1 s · 919 MB (691 private) · 242 major faults; 0.91 s · 2.2 s · 949 MB (726 private) · 262 major faults | | 1M rows, Parquet by DuckDB, 97 MB | compara | warm | 0.22 s · 0.7 s · 384 MB (288 private) · 0 major faults; 0.22 s · 0.7 s · 384 MB (289 private) · 0 major faults; 0.23 s · 0.7 s · 384 MB (289 private) · 0 major faults; 0.22 s · 0.7 s · 384 MB (289 private) · 0 major faults; 0.23 s · 0.7 s · 382 MB (288 private) · 0 major faults | | 1M rows, Parquet by DuckDB, 97 MB | compara | cold | 0.27 s · 0.7 s · 367 MB (288 private) · 376 major faults; 0.28 s · 0.7 s · 366 MB (288 private) · 386 major faults; 0.28 s · 0.7 s · 368 MB (289 private) · 385 major faults; 0.28 s · 0.7 s · 368 MB (289 private) · 381 major faults; 0.28 s · 0.7 s · 369 MB (288 private) · 371 major faults | | 1M rows, Parquet by DuckDB, 97 MB | DuckDB | warm | 0.47 s · 1.7 s · 533 MB (474 private) · 0 major faults; 0.47 s · 1.7 s · 548 MB (488 private) · 0 major faults; 0.46 s · 1.7 s · 542 MB (483 private) · 0 major faults; 0.47 s · 1.7 s · 539 MB (480 private) · 0 major faults; 0.46 s · 1.7 s · 545 MB (486 private) · 0 major faults | | 1M rows, Parquet by DuckDB, 97 MB | DuckDB | cold | 0.48 s · 1.7 s · 544 MB (484 private) · 0 major faults; 0.48 s · 1.8 s · 541 MB (482 private) · 0 major faults; 0.49 s · 1.8 s · 537 MB (478 private) · 0 major faults; 0.48 s · 1.7 s · 544 MB (484 private) · 0 major faults; 0.48 s · 1.7 s · 543 MB (484 private) · 0 major faults | | 1M rows, Parquet by DuckDB, 97 MB | Polars | warm | 0.41 s · 1.8 s · 1,019 MB (948 private) · 0 major faults; 0.43 s · 1.8 s · 1,015 MB (944 private) · 0 major faults; 0.43 s · 1.8 s · 1,021 MB (950 private) · 0 major faults; 0.43 s · 1.8 s · 1,020 MB (950 private) · 0 major faults; 0.44 s · 1.8 s · 1,036 MB (967 private) · 0 major faults | | 1M rows, Parquet by DuckDB, 97 MB | Polars | cold | 0.47 s · 1.9 s · 1,104 MB (1,034 private) · 2 major faults; 0.48 s · 1.9 s · 1,115 MB (1,045 private) · 2 major faults; 0.47 s · 1.9 s · 1,102 MB (1,033 private) · 2 major faults; 0.47 s · 1.9 s · 1,084 MB (1,015 private) · 2 major faults; 0.47 s · 1.9 s · 1,108 MB (1,037 private) · 2 major faults | | 1M rows, Parquet by DuckDB, 97 MB | ClickHouse | warm | 0.79 s · 2.0 s · 995 MB (752 private) · 0 major faults; 0.79 s · 2.0 s · 990 MB (756 private) · 0 major faults; 0.79 s · 2.0 s · 981 MB (739 private) · 0 major faults; 0.76 s · 2.0 s · 967 MB (725 private) · 0 major faults; 0.80 s · 2.0 s · 972 MB (732 private) · 0 major faults | | 1M rows, Parquet by DuckDB, 97 MB | ClickHouse | cold | 0.86 s · 2.0 s · 984 MB (742 private) · 338 major faults; 0.84 s · 2.0 s · 965 MB (720 private) · 349 major faults; 0.83 s · 2.0 s · 982 MB (739 private) · 362 major faults; 0.83 s · 2.0 s · 965 MB (723 private) · 343 major faults; 0.80 s · 2.0 s · 972 MB (728 private) · 326 major faults | | 1M rows, CSV, repeated keys, 368 MB | compara | warm | 0.12 s · 0.3 s · 411 MB (56 private) · 0 major faults; 0.12 s · 0.3 s · 411 MB (56 private) · 0 major faults; 0.12 s · 0.3 s · 411 MB (56 private) · 0 major faults; 0.12 s · 0.3 s · 411 MB (56 private) · 0 major faults; 0.12 s · 0.3 s · 411 MB (56 private) · 0 major faults | | 1M rows, CSV, repeated keys, 368 MB | compara | cold | 0.70 s · 0.4 s · 411 MB (56 private) · 1,404 major faults; 0.74 s · 0.4 s · 411 MB (56 private) · 1,404 major faults; 0.69 s · 0.4 s · 411 MB (56 private) · 1,404 major faults; 0.70 s · 0.4 s · 411 MB (56 private) · 1,404 major faults; 0.72 s · 0.4 s · 411 MB (56 private) · 1,404 major faults | | 1M rows, CSV, repeated keys, 368 MB | DuckDB | warm | 3.18 s · 8.6 s · 1,135 MB (1,075 private) · 0 major faults; 3.18 s · 8.6 s · 1,084 MB (1,025 private) · 0 major faults; 3.16 s · 8.6 s · 1,111 MB (1,051 private) · 0 major faults; 3.15 s · 8.7 s · 1,106 MB (1,045 private) · 0 major faults; 3.15 s · 8.6 s · 1,174 MB (1,113 private) · 0 major faults | | 1M rows, CSV, repeated keys, 368 MB | DuckDB | cold | 3.16 s · 8.5 s · 1,223 MB (1,163 private) · 0 major faults; 3.15 s · 8.7 s · 1,132 MB (1,072 private) · 0 major faults; 3.14 s · 8.6 s · 1,130 MB (1,070 private) · 0 major faults; 3.14 s · 8.6 s · 1,176 MB (1,115 private) · 0 major faults; 3.15 s · 8.6 s · 1,274 MB (1,214 private) · 0 major faults | | 1M rows, CSV, repeated keys, 368 MB | Polars | warm | 3.21 s · 12.0 s · 2,096 MB (2,035 private) · 0 major faults; 3.27 s · 12.1 s · 2,277 MB (2,214 private) · 0 major faults; 3.31 s · 12.0 s · 2,108 MB (2,047 private) · 0 major faults; 3.21 s · 12.0 s · 2,130 MB (2,070 private) · 0 major faults; 3.17 s · 12.0 s · 2,264 MB (2,204 private) · 0 major faults | | 1M rows, CSV, repeated keys, 368 MB | Polars | cold | 3.49 s · 12.2 s · 2,167 MB (2,105 private) · 2 major faults; 3.45 s · 12.1 s · 2,107 MB (2,046 private) · 2 major faults; 3.50 s · 12.3 s · 2,156 MB (2,092 private) · 2 major faults; 3.35 s · 11.9 s · 2,124 MB (2,062 private) · 2 major faults; 3.25 s · 11.9 s · 2,142 MB (2,082 private) · 2 major faults | | 1M rows, CSV, repeated keys, 368 MB | qsv | warm | 0.90 s · 2.3 s · 235 MB (206 private) · 0 major faults; 0.92 s · 2.4 s · 135 MB (104 private) · 0 major faults; 1.08 s · 2.6 s · 353 MB (323 private) · 0 major faults; 0.92 s · 2.3 s · 222 MB (191 private) · 0 major faults; 0.99 s · 2.4 s · 298 MB (269 private) · 0 major faults | | 1M rows, CSV, repeated keys, 368 MB | qsv | cold | 1.12 s · 2.7 s · 330 MB (301 private) · 0 major faults; 1.05 s · 2.6 s · 210 MB (180 private) · 0 major faults; 1.12 s · 2.6 s · 316 MB (285 private) · 0 major faults; 0.92 s · 2.4 s · 135 MB (105 private) · 0 major faults; 1.14 s · 2.7 s · 321 MB (290 private) · 0 major faults | | 1M rows, Parquet by compara-gen-data, repeated keys, 161 MB | compara | warm | 0.15 s · 0.4 s · 339 MB (181 private) · 0 major faults; 0.15 s · 0.4 s · 339 MB (181 private) · 0 major faults; 0.16 s · 0.5 s · 339 MB (181 private) · 0 major faults; 0.15 s · 0.4 s · 339 MB (181 private) · 0 major faults; 0.17 s · 0.4 s · 339 MB (181 private) · 0 major faults | | 1M rows, Parquet by compara-gen-data, repeated keys, 161 MB | compara | cold | 0.25 s · 0.5 s · 338 MB (182 private) · 421 major faults; 0.25 s · 0.5 s · 335 MB (177 private) · 424 major faults; 0.26 s · 0.5 s · 338 MB (182 private) · 425 major faults; 0.25 s · 0.5 s · 338 MB (182 private) · 445 major faults; 0.26 s · 0.5 s · 338 MB (181 private) · 434 major faults | | 1M rows, Parquet by compara-gen-data, repeated keys, 161 MB | DuckDB | warm | 1.73 s · 2.8 s · 1,120 MB (1,060 private) · 0 major faults; 1.70 s · 2.8 s · 1,217 MB (1,157 private) · 0 major faults; 1.77 s · 2.8 s · 1,137 MB (1,077 private) · 0 major faults; 1.74 s · 2.7 s · 1,226 MB (1,166 private) · 0 major faults; 1.79 s · 2.8 s · 1,278 MB (1,217 private) · 0 major faults | | 1M rows, Parquet by compara-gen-data, repeated keys, 161 MB | DuckDB | cold | 1.78 s · 2.8 s · 1,055 MB (995 private) · 0 major faults; 1.81 s · 2.8 s · 1,166 MB (1,105 private) · 0 major faults; 1.79 s · 2.8 s · 1,039 MB (978 private) · 0 major faults; 1.74 s · 2.8 s · 1,232 MB (1,171 private) · 0 major faults; 1.74 s · 2.8 s · 1,126 MB (1,066 private) · 0 major faults | | 1M rows, Parquet by compara-gen-data, repeated keys, 161 MB | Polars | warm | 3.29 s · 11.0 s · 2,225 MB (2,155 private) · 0 major faults; 3.38 s · 10.7 s · 2,455 MB (2,391 private) · 0 major faults; 3.33 s · 10.8 s · 2,206 MB (2,139 private) · 0 major faults; 3.34 s · 11.2 s · 2,329 MB (2,263 private) · 0 major faults; 3.27 s · 10.6 s · 2,310 MB (2,247 private) · 0 major faults | | 1M rows, Parquet by compara-gen-data, repeated keys, 161 MB | Polars | cold | 3.41 s · 11.0 s · 2,202 MB (2,138 private) · 2 major faults; 3.41 s · 11.0 s · 2,249 MB (2,183 private) · 2 major faults; 3.36 s · 10.8 s · 2,298 MB (2,227 private) · 2 major faults; 3.43 s · 11.4 s · 2,186 MB (2,120 private) · 2 major faults; 3.47 s · 11.0 s · 2,287 MB (2,222 private) · 2 major faults | | 10M rows, CSV, 3,679 MB | compara | warm | 0.94 s · 3.1 s · 4,030 MB (512 private) · 0 major faults; 0.94 s · 3.1 s · 4,030 MB (511 private) · 0 major faults; 0.95 s · 3.2 s · 4,030 MB (511 private) · 0 major faults; 0.94 s · 3.1 s · 4,030 MB (511 private) · 0 major faults; 0.94 s · 3.1 s · 4,030 MB (511 private) · 0 major faults | | 10M rows, CSV, 3,679 MB | compara | cold | 9.32 s · 4.2 s · 4,030 MB (512 private) · 14,035 major faults; 9.31 s · 4.3 s · 4,031 MB (511 private) · 14,035 major faults; 9.30 s · 4.2 s · 4,030 MB (511 private) · 14,035 major faults; 9.33 s · 4.2 s · 4,030 MB (512 private) · 14,035 major faults; 9.32 s · 4.2 s · 4,030 MB (510 private) · 14,035 major faults | | 10M rows, CSV, 3,679 MB | DuckDB | warm | 9.85 s · 37.2 s · 4,210 MB (4,148 private) · 0 major faults; 9.87 s · 37.1 s · 4,240 MB (4,178 private) · 6 major faults; 9.89 s · 37.1 s · 4,151 MB (4,102 private) · 3 major faults; 9.88 s · 36.9 s · 4,179 MB (4,131 private) · 8 major faults; 9.81 s · 37.1 s · 4,153 MB (4,105 private) · 6 major faults | | 10M rows, CSV, 3,679 MB | DuckDB | cold | 10.18 s · 36.9 s · 4,228 MB (4,165 private) · 6 major faults; 10.23 s · 36.9 s · 4,184 MB (4,136 private) · 6 major faults; 10.20 s · 36.7 s · 4,232 MB (4,183 private) · 6 major faults; 10.16 s · 36.8 s · 4,214 MB (4,166 private) · 6 major faults; 10.19 s · 36.9 s · 4,166 MB (4,117 private) · 0 major faults | | 10M rows, CSV, 3,679 MB | Polars | warm | 9.75 s · 35.7 s · 9,880 MB (9,816 private) · 0 major faults; 9.99 s · 35.8 s · 9,878 MB (9,814 private) · 0 major faults; 9.95 s · 35.8 s · 10,074 MB (10,036 private) · 3 major faults; 9.70 s · 35.4 s · 9,921 MB (9,882 private) · 1 major faults; 9.67 s · 35.7 s · 9,924 MB (9,888 private) · 0 major faults | | 10M rows, CSV, 3,679 MB | Polars | cold | 13.37 s · 35.8 s · 10,081 MB (10,022 private) · 4 major faults; 13.56 s · 36.0 s · 10,023 MB (9,986 private) · 4 major faults; 13.36 s · 35.5 s · 10,370 MB (10,332 private) · 4 major faults; 13.25 s · 35.6 s · 10,195 MB (10,155 private) · 4 major faults; 13.46 s · 35.2 s · 9,895 MB (9,855 private) · 2 major faults | | 10M rows, CSV, 3,679 MB | qsv | warm | 11.96 s · 28.0 s · 2,135 MB (2,106 private) · 5 major faults; 11.72 s · 27.8 s · 2,123 MB (2,096 private) · 0 major faults; 11.19 s · 27.6 s · 1,543 MB (1,516 private) · 0 major faults; 11.94 s · 27.6 s · 2,318 MB (2,290 private) · 0 major faults; 10.07 s · 26.3 s · 1,112 MB (1,085 private) · 0 major faults | | 10M rows, CSV, 3,679 MB | qsv | cold | 12.29 s · 28.6 s · 2,184 MB (2,154 private) · 2 major faults; 10.38 s · 25.4 s · 1,139 MB (1,112 private) · 2 major faults; 10.59 s · 25.9 s · 1,667 MB (1,640 private) · 2 major faults; 11.08 s · 27.3 s · 1,806 MB (1,779 private) · 2 major faults; 10.76 s · 27.6 s · 1,075 MB (1,048 private) · 2 major faults | | 10M rows, CSV, 3,679 MB | ClickHouse | warm | 30.26 s · 76.0 s · 7,655 MB (5,923 private) · 11 major faults; 29.88 s · 75.3 s · 7,682 MB (5,963 private) · 11 major faults; 30.09 s · 75.7 s · 7,637 MB (5,979 private) · 11 major faults; 29.98 s · 75.6 s · 7,590 MB (5,942 private) · 2 major faults; 30.04 s · 75.8 s · 7,662 MB (5,986 private) · 6 major faults | | 10M rows, CSV, 3,679 MB | ClickHouse | cold | 30.17 s · 75.6 s · 7,691 MB (5,995 private) · 13 major faults; 29.97 s · 75.4 s · 7,679 MB (6,005 private) · 13 major faults; 30.30 s · 75.8 s · 7,656 MB (5,957 private) · 13 major faults; 29.94 s · 74.8 s · 7,482 MB (5,807 private) · 14 major faults; 29.77 s · 74.9 s · 7,731 MB (5,979 private) · 11 major faults | | 10M rows, Parquet by compara-gen-data, 1,609 MB | compara | warm | 1.17 s · 3.8 s · 2,776 MB (1,262 private) · 0 major faults; 1.16 s · 3.8 s · 2,776 MB (1,261 private) · 0 major faults; 1.14 s · 3.7 s · 2,779 MB (1,264 private) · 0 major faults; 1.15 s · 3.8 s · 2,778 MB (1,263 private) · 0 major faults; 1.16 s · 3.8 s · 2,778 MB (1,263 private) · 0 major faults | | 10M rows, Parquet by compara-gen-data, 1,609 MB | compara | cold | 4.03 s · 3.8 s · 2,798 MB (1,260 private) · 4,402 major faults; 4.05 s · 3.7 s · 2,795 MB (1,257 private) · 4,314 major faults; 4.00 s · 3.7 s · 2,797 MB (1,259 private) · 4,330 major faults; 4.00 s · 3.7 s · 2,797 MB (1,259 private) · 4,276 major faults; 4.04 s · 3.7 s · 2,797 MB (1,259 private) · 4,358 major faults | | 10M rows, Parquet by compara-gen-data, 1,609 MB | DuckDB | warm | 4.87 s · 17.2 s · 4,885 MB (4,838 private) · 0 major faults; 4.91 s · 17.2 s · 5,035 MB (4,989 private) · 0 major faults; 5.13 s · 17.9 s · 4,997 MB (4,950 private) · 0 major faults; 4.93 s · 17.3 s · 5,044 MB (4,997 private) · 0 major faults; 4.97 s · 17.5 s · 4,899 MB (4,853 private) · 0 major faults | | 10M rows, Parquet by compara-gen-data, 1,609 MB | DuckDB | cold | 5.79 s · 16.9 s · 4,892 MB (4,846 private) · 0 major faults; 5.88 s · 16.9 s · 4,959 MB (4,913 private) · 0 major faults; 5.91 s · 16.9 s · 5,109 MB (5,062 private) · 0 major faults; 6.04 s · 16.9 s · 4,989 MB (4,942 private) · 0 major faults; 6.02 s · 17.0 s · 4,886 MB (4,839 private) · 0 major faults | | 10M rows, Parquet by compara-gen-data, 1,609 MB | Polars | warm | 5.87 s · 19.1 s · 10,753 MB (10,716 private) · 3 major faults; 5.97 s · 19.2 s · 10,760 MB (10,723 private) · 0 major faults; 5.99 s · 19.3 s · 10,739 MB (10,701 private) · 0 major faults; 5.99 s · 19.3 s · 10,763 MB (10,726 private) · 0 major faults; 5.93 s · 19.2 s · 10,757 MB (10,720 private) · 0 major faults | | 10M rows, Parquet by compara-gen-data, 1,609 MB | Polars | cold | 7.77 s · 19.7 s · 10,730 MB (10,692 private) · 2 major faults; 7.50 s · 19.7 s · 10,734 MB (10,697 private) · 2 major faults; 7.74 s · 19.9 s · 10,751 MB (10,713 private) · 2 major faults; 7.67 s · 19.7 s · 10,745 MB (10,707 private) · 2 major faults; 7.67 s · 19.8 s · 10,753 MB (10,715 private) · 2 major faults | | 10M rows, Parquet by compara-gen-data, 1,609 MB | ClickHouse | warm | 23.52 s · 51.0 s · 7,190 MB (6,244 private) · 5 major faults; 23.98 s · 51.6 s · 6,931 MB (5,981 private) · 7 major faults; 23.94 s · 51.6 s · 7,181 MB (6,236 private) · 0 major faults; 23.79 s · 51.6 s · 7,154 MB (6,208 private) · 0 major faults; 23.82 s · 51.6 s · 7,102 MB (6,157 private) · 0 major faults | | 10M rows, Parquet by compara-gen-data, 1,609 MB | ClickHouse | cold | 23.93 s · 51.9 s · 7,103 MB (6,158 private) · 4,871 major faults; 24.04 s · 51.9 s · 7,113 MB (6,168 private) · 4,857 major faults; 23.84 s · 51.5 s · 7,142 MB (6,197 private) · 4,944 major faults; 23.99 s · 51.9 s · 7,126 MB (6,180 private) · 5,002 major faults; 24.21 s · 52.3 s · 7,100 MB (6,155 private) · 4,910 major faults | | 10M rows, Parquet by Polars, 609 MB | compara | warm | 2.43 s · 7.9 s · 3,164 MB (2,587 private) · 0 major faults; 2.22 s · 7.8 s · 3,126 MB (2,540 private) · 0 major faults; 2.23 s · 7.9 s · 3,163 MB (2,581 private) · 0 major faults; 2.24 s · 7.9 s · 3,155 MB (2,571 private) · 0 major faults; 2.24 s · 7.8 s · 3,138 MB (2,551 private) · 0 major faults | | 10M rows, Parquet by Polars, 609 MB | compara | cold | 2.55 s · 7.8 s · 2,970 MB (2,617 private) · 2,948 major faults; 2.59 s · 7.8 s · 2,985 MB (2,626 private) · 2,945 major faults; 2.57 s · 7.8 s · 2,974 MB (2,609 private) · 2,963 major faults; 2.53 s · 7.8 s · 2,972 MB (2,605 private) · 2,939 major faults; 2.57 s · 7.7 s · 3,004 MB (2,628 private) · 2,950 major faults | | 10M rows, Parquet by Polars, 609 MB | DuckDB | warm | 4.81 s · 18.3 s · 3,576 MB (3,529 private) · 0 major faults; 4.77 s · 18.3 s · 3,576 MB (3,529 private) · 0 major faults; 4.74 s · 18.4 s · 3,572 MB (3,525 private) · 0 major faults; 4.71 s · 18.2 s · 3,571 MB (3,524 private) · 0 major faults; 4.70 s · 18.2 s · 3,577 MB (3,530 private) · 0 major faults | | 10M rows, Parquet by Polars, 609 MB | DuckDB | cold | 4.81 s · 18.4 s · 3,569 MB (3,522 private) · 0 major faults; 4.84 s · 18.6 s · 3,568 MB (3,521 private) · 0 major faults; 4.80 s · 18.5 s · 3,571 MB (3,524 private) · 0 major faults; 4.72 s · 18.4 s · 3,578 MB (3,531 private) · 0 major faults; 4.77 s · 18.5 s · 3,576 MB (3,529 private) · 0 major faults | | 10M rows, Parquet by Polars, 609 MB | Polars | warm | 5.39 s · 20.4 s · 9,084 MB (9,039 private) · 0 major faults; 5.37 s · 20.5 s · 9,058 MB (9,020 private) · 0 major faults; 5.42 s · 20.4 s · 9,206 MB (9,167 private) · 0 major faults; 5.28 s · 20.4 s · 9,132 MB (9,095 private) · 0 major faults; 5.39 s · 20.4 s · 8,966 MB (8,926 private) · 0 major faults | | 10M rows, Parquet by Polars, 609 MB | Polars | cold | 5.86 s · 21.0 s · 8,997 MB (8,957 private) · 4 major faults; 5.82 s · 20.9 s · 8,824 MB (8,779 private) · 4 major faults; 5.84 s · 20.9 s · 9,012 MB (8,972 private) · 4 major faults; 5.78 s · 21.0 s · 9,113 MB (9,074 private) · 4 major faults; 5.76 s · 20.9 s · 8,893 MB (8,855 private) · 4 major faults | | 10M rows, Parquet by Polars, 609 MB | ClickHouse | warm | 23.39 s · 49.3 s · 6,708 MB (6,212 private) · 0 major faults; 23.56 s · 49.4 s · 6,779 MB (6,291 private) · 0 major faults; 23.29 s · 48.8 s · 6,639 MB (6,152 private) · 0 major faults; 23.54 s · 49.4 s · 6,805 MB (6,317 private) · 0 major faults; 23.27 s · 49.1 s · 6,851 MB (6,364 private) · 0 major faults | | 10M rows, Parquet by Polars, 609 MB | ClickHouse | cold | 23.33 s · 49.2 s · 6,696 MB (6,209 private) · 2,524 major faults; 23.47 s · 49.5 s · 6,683 MB (6,196 private) · 2,512 major faults; 23.39 s · 49.5 s · 6,913 MB (6,425 private) · 2,542 major faults; 23.62 s · 50.3 s · 6,625 MB (6,137 private) · 2,516 major faults; 23.82 s · 50.8 s · 6,836 MB (6,349 private) · 2,514 major faults | | 10M rows, Parquet by DuckDB, 964 MB | compara | warm | 1.73 s · 5.9 s · 3,589 MB (2,664 private) · 0 major faults; 1.74 s · 5.9 s · 3,585 MB (2,665 private) · 0 major faults; 1.73 s · 5.9 s · 3,596 MB (2,675 private) · 0 major faults; 1.73 s · 5.9 s · 3,605 MB (2,686 private) · 0 major faults; 1.72 s · 5.9 s · 3,592 MB (2,671 private) · 0 major faults | | 10M rows, Parquet by DuckDB, 964 MB | compara | cold | 2.73 s · 6.0 s · 3,427 MB (2,674 private) · 3,719 major faults; 2.67 s · 6.0 s · 3,393 MB (2,655 private) · 3,732 major faults; 2.67 s · 6.0 s · 3,404 MB (2,657 private) · 3,779 major faults; 2.72 s · 6.0 s · 3,403 MB (2,660 private) · 3,743 major faults; 2.69 s · 5.9 s · 3,416 MB (2,667 private) · 3,723 major faults | | 10M rows, Parquet by DuckDB, 964 MB | DuckDB | warm | 3.91 s · 15.2 s · 3,424 MB (3,376 private) · 0 major faults; 3.93 s · 15.2 s · 3,417 MB (3,370 private) · 0 major faults; 3.95 s · 15.1 s · 3,419 MB (3,372 private) · 0 major faults; 3.91 s · 15.2 s · 3,406 MB (3,359 private) · 0 major faults; 3.95 s · 15.1 s · 3,422 MB (3,375 private) · 0 major faults | | 10M rows, Parquet by DuckDB, 964 MB | DuckDB | cold | 3.95 s · 15.3 s · 3,419 MB (3,372 private) · 0 major faults; 3.96 s · 15.3 s · 3,426 MB (3,379 private) · 0 major faults; 3.95 s · 15.3 s · 3,421 MB (3,374 private) · 0 major faults; 3.92 s · 15.2 s · 3,410 MB (3,361 private) · 0 major faults; 4.00 s · 15.4 s · 3,422 MB (3,375 private) · 0 major faults | | 10M rows, Parquet by DuckDB, 964 MB | Polars | warm | 4.64 s · 17.8 s · 8,794 MB (8,755 private) · 0 major faults; 4.69 s · 17.8 s · 8,702 MB (8,661 private) · 0 major faults; 4.63 s · 17.8 s · 8,775 MB (8,735 private) · 0 major faults; 4.79 s · 17.8 s · 8,624 MB (8,582 private) · 0 major faults; 4.66 s · 17.8 s · 8,534 MB (8,491 private) · 0 major faults | | 10M rows, Parquet by DuckDB, 964 MB | Polars | cold | 5.51 s · 18.3 s · 8,475 MB (8,436 private) · 4 major faults; 5.47 s · 18.3 s · 8,641 MB (8,599 private) · 4 major faults; 5.39 s · 18.3 s · 8,587 MB (8,544 private) · 4 major faults; 5.47 s · 18.3 s · 8,356 MB (8,309 private) · 4 major faults; 5.45 s · 18.3 s · 8,565 MB (8,527 private) · 4 major faults | | 10M rows, Parquet by DuckDB, 964 MB | ClickHouse | warm | 22.82 s · 47.0 s · 6,540 MB (5,885 private) · 0 major faults; 23.12 s · 47.5 s · 6,562 MB (5,904 private) · 0 major faults; 22.95 s · 46.8 s · 6,567 MB (5,913 private) · 0 major faults; 22.88 s · 47.1 s · 6,504 MB (5,849 private) · 0 major faults; 22.86 s · 46.9 s · 6,603 MB (5,943 private) · 0 major faults | | 10M rows, Parquet by DuckDB, 964 MB | ClickHouse | cold | 23.03 s · 47.2 s · 6,497 MB (5,841 private) · 3,374 major faults; 23.20 s · 47.7 s · 6,589 MB (5,934 private) · 3,391 major faults; 23.21 s · 47.3 s · 6,578 MB (5,923 private) · 3,407 major faults; 23.20 s · 47.7 s · 6,391 MB (5,735 private) · 3,424 major faults; 23.26 s · 47.3 s · 6,635 MB (5,979 private) · 3,392 major faults | | 10M rows, CSV, repeated keys, 3,679 MB | compara | warm | 0.98 s · 3.1 s · 4,030 MB (512 private) · 0 major faults; 0.94 s · 3.1 s · 4,030 MB (511 private) · 1 major faults; 0.94 s · 3.1 s · 4,030 MB (512 private) · 0 major faults; 0.94 s · 3.1 s · 4,031 MB (511 private) · 1 major faults; 0.95 s · 3.1 s · 4,030 MB (510 private) · 2 major faults | | 10M rows, CSV, repeated keys, 3,679 MB | compara | cold | 9.30 s · 4.2 s · 4,031 MB (511 private) · 14,037 major faults; 9.30 s · 4.2 s · 4,031 MB (512 private) · 14,037 major faults; 9.33 s · 4.2 s · 4,031 MB (512 private) · 14,037 major faults; 9.31 s · 4.2 s · 4,031 MB (511 private) · 14,038 major faults; 9.30 s · 4.2 s · 4,031 MB (511 private) · 14,036 major faults | | 10M rows, CSV, repeated keys, 3,679 MB | DuckDB | warm | 24.79 s · 88.4 s · 8,737 MB (8,687 private) · 2 major faults; 24.93 s · 88.7 s · 8,754 MB (8,705 private) · 0 major faults; 24.49 s · 88.0 s · 8,924 MB (8,865 private) · 0 major faults; 24.89 s · 88.6 s · 8,876 MB (8,807 private) · 0 major faults; 24.84 s · 88.5 s · 8,742 MB (8,692 private) · 0 major faults | | 10M rows, CSV, repeated keys, 3,679 MB | DuckDB | cold | 25.01 s · 88.3 s · 8,904 MB (8,843 private) · 15 major faults; 24.60 s · 88.2 s · 8,773 MB (8,723 private) · 13 major faults; 24.55 s · 88.5 s · 8,757 MB (8,707 private) · 13 major faults; 24.99 s · 88.4 s · 8,760 MB (8,704 private) · 25 major faults; 24.92 s · 88.4 s · 8,798 MB (8,744 private) · 0 major faults | | 10M rows, CSV, repeated keys, 3,679 MB | Polars | warm | out of memory after 17 s, at 13,319 MB | | 10M rows, CSV, repeated keys, 3,679 MB | qsv | warm | 12.19 s · 27.9 s · 2,528 MB (2,501 private) · 5 major faults; 10.48 s · 26.9 s · 1,409 MB (1,382 private) · 0 major faults; 10.66 s · 26.3 s · 1,418 MB (1,391 private) · 0 major faults; 12.55 s · 28.6 s · 2,519 MB (2,493 private) · 0 major faults; 9.87 s · 26.4 s · 1,001 MB (975 private) · 0 major faults | | 10M rows, CSV, repeated keys, 3,679 MB | qsv | cold | 11.40 s · 27.4 s · 1,634 MB (1,609 private) · 5 major faults; 12.41 s · 28.4 s · 2,381 MB (2,354 private) · 5 major faults; 10.85 s · 26.3 s · 1,332 MB (1,305 private) · 5 major faults; 11.05 s · 28.1 s · 1,145 MB (1,120 private) · 16 major faults; 11.03 s · 26.6 s · 1,919 MB (1,893 private) · 8 major faults | | 10M rows, Parquet by compara-gen-data, repeated keys, 1,609 MB | compara | warm | 1.15 s · 3.8 s · 2,856 MB (1,341 private) · 2 major faults; 1.17 s · 3.8 s · 2,853 MB (1,338 private) · 0 major faults; 1.17 s · 3.8 s · 2,855 MB (1,340 private) · 0 major faults; 1.13 s · 3.7 s · 2,852 MB (1,338 private) · 0 major faults; 1.16 s · 3.7 s · 2,855 MB (1,340 private) · 0 major faults | | 10M rows, Parquet by compara-gen-data, repeated keys, 1,609 MB | compara | cold | 4.04 s · 3.8 s · 2,876 MB (1,338 private) · 4,371 major faults; 4.02 s · 3.7 s · 2,874 MB (1,336 private) · 4,303 major faults; 4.05 s · 3.8 s · 2,869 MB (1,328 private) · 4,365 major faults; 4.04 s · 3.8 s · 2,876 MB (1,338 private) · 4,326 major faults; 4.02 s · 3.7 s · 2,878 MB (1,339 private) · 4,292 major faults | | 10M rows, Parquet by compara-gen-data, repeated keys, 1,609 MB | DuckDB | warm | 9.88 s · 34.4 s · 6,650 MB (6,602 private) · 11 major faults; 9.87 s · 34.3 s · 6,880 MB (6,827 private) · 0 major faults; 9.72 s · 34.7 s · 6,817 MB (6,769 private) · 0 major faults; 9.93 s · 34.5 s · 6,713 MB (6,662 private) · 0 major faults; 9.66 s · 34.4 s · 6,653 MB (6,605 private) · 0 major faults | | 10M rows, Parquet by compara-gen-data, repeated keys, 1,609 MB | DuckDB | cold | 10.22 s · 34.2 s · 6,683 MB (6,635 private) · 13 major faults; 10.39 s · 34.3 s · 6,658 MB (6,610 private) · 0 major faults; 10.39 s · 34.4 s · 6,676 MB (6,628 private) · 0 major faults; 10.43 s · 34.4 s · 6,635 MB (6,587 private) · 0 major faults; 10.76 s · 34.4 s · 6,670 MB (6,622 private) · 0 major faults | | 10M rows, Parquet by compara-gen-data, repeated keys, 1,609 MB | Polars | warm | out of memory after 74 s, at 13,291 MB | ## Versions compara built from the run's commit (compara 0.8.0); DuckDB 2.0.1 and Polars 2.1.0 installed from PyPI at their latest in the run, on Python 3.13.18. qsv 29.0.0 is its release binary, as downloaded in the run. ClickHouse 26.9.36.3 is its official release binary (`ClickHouse local version 26.9.36.3 (official build).`), as downloaded in the run. ## Method Each pair is written by `compara-gen-data` (seed 7). The headline pairs have no key twice in a file (`--unique-keys`); the others are the generator's default, where 0.01% of a file's keys appear twice (rows otherwise the same). Parquet comes from three writers, and every tool reads the same files: compara-gen-data's own (every column a string, uncompressed), and, on the unique-key pairs, the generator's CSV pair as Polars (`pl.read_csv(csv).write_parquet(out)`) and DuckDB (`COPY (SELECT * FROM read_csv(csv)) TO out (FORMAT parquet)`) write it with their defaults: their own type inference, compression and row groups, in a process of their own before any timing. As file A of each pair holds it: - 1M rows, Parquet by compara-gen-data, 161 MB: uncompressed, 1 row group, every column a string. - 1M rows, Parquet by Polars, 61 MB: zstd, 12 row groups, typed columns: amount, fee, balance, rate DOUBLE; quantity BIGINT, the rest strings. - 1M rows, Parquet by DuckDB, 97 MB: snappy, 9 row groups, typed columns: posting_date, value_date DATE; amount, fee, balance, rate DOUBLE; quantity BIGINT; updated_at TIMESTAMP, the rest strings. - 1M rows, Parquet by compara-gen-data, repeated keys, 161 MB: uncompressed, 2 row groups, every column a string. - 10M rows, Parquet by compara-gen-data, 1,609 MB: uncompressed, 10 row groups, every column a string. - 10M rows, Parquet by Polars, 609 MB: zstd, 114 row groups, typed columns: amount, fee, balance, rate DOUBLE; quantity BIGINT, the rest strings. - 10M rows, Parquet by DuckDB, 964 MB: snappy, 81 row groups, typed columns: posting_date, value_date DATE; amount, fee, balance, rate DOUBLE; quantity BIGINT; updated_at TIMESTAMP, the rest strings. - 10M rows, Parquet by compara-gen-data, repeated keys, 1,609 MB: uncompressed, 11 row groups, every column a string. Before each run the files that tool reads are put in a stated page-cache state: warm, read to the end just before the run; cold, dropped from the page cache (`posix_fadvise` DONTNEED), so the tool reads them from the runner's disk. The state is set for every tool alike, so no tool starts warmer because of what the one before it did (in runs before this was done, a tool killed for memory left the next one's inputs evicted: compara's 10M-row CSV took 0.70 s in one round and 9.33 s in the next, run 44629611468). Each run records the share of its inputs in the page cache as it starts and its major page faults. Each round also times reading both inputs from a cold cache, the least any tool's cold run can take. Each tool runs in a process of its own; CPU time and peak RSS are that process's (`wait4`). Peak RSS counts the pages of files a tool maps, which the kernel can drop and read again under memory pressure: compara maps both inputs, so most of its RSS is the files themselves. The private part is the tool's own memory (heap, stacks; `RssAnon` of its process tree, sampled every 5 ms, so a lower bound), what a container limit has to leave it. Each tool computes what compara does: values compared as text in CSV and by value in Parquet (in the file's types), and an empty field equal only to an empty field. Where no key repeats, each runs its plainest query: DuckDB reads each file where it is (`read_csv(..., all_varchar = true)` or `read_parquet`) and counts over a FULL OUTER JOIN on the key; Polars scans both (`scan_csv(infer_schema=False)` or `scan_parquet`) and counts over a full join, on its default engine, which its streaming engine did not beat; qsv runs `qsv diff -k account_id,txn_id` on the files with the ignored column cut (`qsv select`, untimed), its output written to a file and the counts read back from it, unchanged being the left file's rows (`qsv count`) less the changed and removed; ClickHouse runs `clickhouse local` with the files read where they are (`file`, CSV as String columns), a FULL OUTER JOIN on the key with `join_use_nulls = 1`, so a row missing from one side has NULLs there, and a NULL counted equal only to a NULL; every tool on every core. Where keys repeat, a key that appears twice in a file is compared by its first row, and the other tools have to be told so: DuckDB loads each CSV into a table once for a row order and keeps each key's first row (`QUALIFY row_number()` by `rowid`; on Parquet by `file_row_number`, read in place), Polars adds `unique(keep="first")`, and qsv, whose keys must be unique, is given each key's first row by `qsv extdedup`, untimed. ClickHouse is not run there. The run fails unless every tool that finishes gives the same counts: 1M rows, CSV, 368 MB: 938,951 unchanged, 60,049 changed, 1,000 added, 1,000 removed; 1M rows, Parquet by compara-gen-data, 161 MB: 938,951 unchanged, 60,049 changed, 1,000 added, 1,000 removed; 1M rows, Parquet by Polars, 61 MB: 938,951 unchanged, 60,049 changed, 1,000 added, 1,000 removed; 1M rows, Parquet by DuckDB, 97 MB: 938,951 unchanged, 60,049 changed, 1,000 added, 1,000 removed; 1M rows, CSV, repeated keys, 368 MB: 938,951 unchanged, 60,049 changed, 1,000 added, 1,000 removed; 1M rows, Parquet by compara-gen-data, repeated keys, 161 MB: 938,951 unchanged, 60,049 changed, 1,000 added, 1,000 removed; 10M rows, CSV, 3,679 MB: 9,390,680 unchanged, 599,320 changed, 10,000 added, 10,000 removed; 10M rows, Parquet by compara-gen-data, 1,609 MB: 9,390,680 unchanged, 599,320 changed, 10,000 added, 10,000 removed; 10M rows, Parquet by Polars, 609 MB: 9,390,680 unchanged, 599,320 changed, 10,000 added, 10,000 removed; 10M rows, Parquet by DuckDB, 964 MB: 9,390,680 unchanged, 599,320 changed, 10,000 added, 10,000 removed; 10M rows, CSV, repeated keys, 3,679 MB: 9,390,680 unchanged, 599,320 changed, 10,000 added, 10,000 removed; 10M rows, Parquet by compara-gen-data, repeated keys, 1,609 MB: 9,390,680 unchanged, 599,320 changed, 10,000 added, 10,000 removed. To run it yourself, from a checkout with compara built and `pip install duckdb polars`: ```sh python3 scripts/bench_contenders.py --compara target/release/compara \ --gen target/release/compara-gen-data --rows 1m,10m --json results.json python3 scripts/gen_bench_docs.py results.json --page bench.md ``` ## Benchmarks on object storage Against DuckDB 2.0.0 reading the same objects over S3 (`httpfs`), on one keyed comparison of 10M rows a side, both tools giving the same four counts, an S3 server (SeaweedFS) on the same 4-core runner, best of three ([CI run 39793328982](https://github.com/andrey-usa/compara-polyglot-experiments/actions/runs/39793328982)): | input on S3 | compara | DuckDB | peak RSS, compara / DuckDB | |---|---:|---:|---:| | Parquet, every column | 9.5 s | 25.3 s | 2.7 / 9.7 GB | | Parquet, one compared column | 6.7 s | 10.3 s | 2.0 / 3.9 GB | | Parquet, 9 parts under a prefix | 3.5 s | 20.8 s | 3.8 / 9.1 GB | | CSV, 1.7 GB a side | 21.5 s | 60.2 s | 4.1 / 13.8 GB | The single objects come off this server at about 90 MB/s each however many ranges are in flight, which is most of compara's time on them; the parts, fetched together, come at 340 MB/s. --- Made from [docs/benchmarks.md](https://github.com/andrey-usa/compara/blob/main/docs/benchmarks.md), [docs/benchmarks-s3.md](https://github.com/andrey-usa/compara/blob/main/docs/benchmarks-s3.md). # Where compara is not ahead Each measure on which another tool beat compara in the same run. Numbers: [bench-contenders run 45112799027](https://github.com/andrey-usa/compara/actions/runs/45112799027), 2026-11-23. Each measure of the benchmarks on which another tool beat compara in this run by more than 2%, read from its results: wall time, CPU time, peak memory and, where the run sampled it, peak private memory, on each input, with unique keys or repeated. Closer than that is a tie. Peak memory counts the input files compara maps, which the kernel can drop; private memory is what the tool holds itself. - Peak memory on 1M rows, CSV, 368 MB: qsv 135 MB, compara 411 MB. - Peak memory on 1M rows, CSV, repeated keys, 368 MB: qsv 222 MB, compara 411 MB. - Peak memory on 10M rows, CSV, 3,679 MB: qsv 2,123 MB, compara 4,030 MB. - Peak memory on 10M rows, Parquet by DuckDB, 964 MB: DuckDB 3,417 MB, compara 3,589 MB. - Peak memory on 10M rows, CSV, repeated keys, 3,679 MB: qsv 1,418 MB, compara 4,031 MB. --- Made from [docs/losses.md](https://github.com/andrey-usa/compara/blob/main/docs/losses.md). # Changelog What changed in each release, and what is on the way. All notable changes to this project are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/). ## [Unreleased] ## [0.9.0] - 2026-11-25 ### Added - `compara-gen-data --unique-keys` writes the pair without its repeated keys (0.01% of a file's), every other row the same. ### Changed - A Hive part whose rows hold a partition column themselves gives it the directory's value in every row, as DuckDB reads such a table (CSV, JSON and Parquet parts) and Polars (Parquet parts). A CSV or Parquet part kept its own value, and a JSON part went by its first row: with the column there, rows without it had none; without it, the directory's value replaced the later rows' own. - JSON is compared with fewer instructions: where the CPU has AVX2 (x86-64) or NEON (ARM), the walk over each row's keys reads its bytes a vector register at a time, and tells each member by one compare; elsewhere it reads them as before, with the same answers. On the perf gate's pair of 200,000 compact NDJSON rows a side, a compare takes 1,318.7M instructions against 0.8.0's 1,702.5M (-22.5%, with the next entry's change; [run 45638875050](https://github.com/andrey-usa/compara/actions/runs/45638875050), cachegrind). - NDJSON written with a space after each comma and colon, as Python's `json.dumps` writes it by default, is compared with about as many instructions as compact NDJSON (1.05x), where 0.8.0 took 2.13x: each member is told by its name and separators as the file's first row spells them. On the perf gate's 200,000-row pair, 3,624.6M instructions became 1,382.5M (-61.9%, [run 45638875050](https://github.com/andrey-usa/compara/actions/runs/45638875050)). The perf gate counts both spellings, so a change that loses this fails. - The release binaries, the perf gate and the benchmarks are built by one named rustc, 1.100.0 (`rust-toolchain.toml`), where each run took the stable Rust of its day, and each names it: a release's notes give the rustc of its binaries, and the perf gate and the benchmark results the rustc of every binary they count. A new rustc moves those counts with no change to the code, so a bump shows what the compiler alone moves. - A pair too large to hold in memory, which the text engine joins inside the first file's sweep, has each file's pages let go of once they are read (Linux): under a container's memory limit the kernel then takes back plain page cache instead of pages it must first unmap, and the run's peak RSS falls to a fraction of the two files' size. Pairs that fit are unchanged. - An `http(s)://` file whose first request is redirected (every GitHub release asset is sent to a signed URL on its CDN) has its parts asked where it was sent, rather than each redirected again; once that address refuses them, as a signed URL does when it expires, the URL itself is asked again. - The weekly comparison against other tools (bench-contenders) leads with pairs where no key repeats in a file, on which each tool runs its plainest query; the pairs that repeat keys, where the others have to be told to keep a key's first row, stay as a table of their own. Parquet is also measured as Polars and DuckDB write it with their defaults, beside `compara-gen-data`'s own; ClickHouse (`clickhouse local`) joins on the unique-key pairs; and the tools' order turns each round. ### Fixed - A nested JSON value against a CSV cell or a Parquet string holding the same JSON as `json.dumps` writes it (`{"a": [1, 2]}`) was changed, and equal only when the JSON was compact: the cell was read as written, the nested value past its spacing. A text cell that is one JSON object or array is now read the same way against a nested value, key columns too; other text, and a JSON string, is compared as written. - A partitioned JSON part with a row that never closes (a brace missing, a string left open) is refused by its own name and the line the row opens on. The rows from it on had been given no partition values, and the error named a line of the joined parts, in a later part. - A lone surrogate in a nested JSON value (`["\ud800"]`) is shown as its escape in the report and the export, where every one read as U+FFFD: two different values looked alike, and under `--trim` or `--ignore-case` they were equal. - The same for a JSON string (`"\ud800"` against `"\ud801"`): under `--trim` or `--ignore-case` the two were equal, as cells and as keys, and in the report a changed row showed no changed cell. They now compare apart under every option, and a lone surrogate is shown as its escape. Every other value is shown and exported as written, so a lone surrogate and a string holding its six characters (`\ud800`) look alike; the cell is still listed as changed. - On Windows, a URL whose server refused the connection was reported as the raw error, without saying the connection was refused or that a proxy was set: Windows words it "actively refused", or in the language it is set up in. It is now told as on Unix, in any language, as is a connection the system gave up on. - On Windows, `-o NUL` and `--json NUL` failed (exit 2, after the whole compare) since 0.8.0 wrote each output beside its name and moved it there. `NUL` and the other names Windows takes as devices (`CON`, `AUX`, in any directory and any case) are written as devices again, as `/dev/null` is on Unix: the output is thrown away and the run succeeds. - On Windows, an output another program has open without letting it be replaced is left as it was, and the error says so and what to do (close it there, or name another file), where it said only "Access is denied" or "being used by another process". - An output written in place (a directory that takes no new file, another user's file in a sticky directory, a file mounted at the name) that a failed run cut short is named in the error as left incomplete: what is there is the start of the new file and can look whole. - `sortmerge` read every spilled run through a 64 KB buffer of its own, so under a heap limit (`ulimit -d`, a container's) a large file's buffers grew with the file, not the limit, and the merge aborted (exit 134) or ran out of open files. Each run is now read through a share of the heap the merge may have, taken with a refusal rather than an abort, and runs beyond what fits, or beyond what `ulimit -n` allows, are merged in passes first; equal keys keep their order in the file. A row also asks its batch for room enough for lower case (`--ignore-case`) and for a column named twice. - `sortmerge` sorting a batch under a heap limit (`ulimit -d`, a container's) took the batch's sort order, the stable sort's scratch copy of it, the buffer the run is written through and room in the list of runs from the allocator with no way to refuse them, and near the limit the process aborted (exit 134, "memory allocation of ... bytes failed"); so could a merge reading back a row longer than the ones before it. Each is now asked for with a refusal (exit 2, naming the limit), and the sort needs no scratch copy: equal keys are ordered by their place in the file. The batches the sort gives back are let go of before the merge's passes, which had been refused the room they held, and a refusal at the limit is written in room set aside for it, where writing it could abort too. - Under `--engine auto`, a CSV pair that does not fit `turbo` now falls back to `sortmerge` under any heap limit a named `sortmerge` starts under, where it had been refused under limits `sortmerge` alone would have answered in, and a named `sortmerge` starts under smaller limits than before. At 16 threads under such a limit, `auto` was still refused where `--engine sortmerge` answered: the C library keeps a finished thread's stack mapped for the next thread, the limit counts it, and `turbo`'s threads had taken most of the limit before it handed the pair over. Under a heap limit (`ulimit -d`, or a container's), thread stacks now take at most a third of it, so under a tight limit fewer threads run, and the fallback sizes `sortmerge` from what `turbo` left. - A run killed while `sortmerge` spilled (SIGKILL, the OOM killer, an abort) left its runs in the temporary directory for good, and enough such runs filled the disk; a killed run's spooled standard input, download, decompressed copy or table of parts stayed there too. The next run that makes a temporary file or directory now removes what killed runs left there: only files and directories by compara's own names, this user's and closed to others, a file with no other name, a directory holding only the files compara writes in it, whose process is gone and whose run is over: each run now locks each of its temporary files and directories and names it `...-locked`, and such a one goes once nothing of it has changed for a minute. One an earlier version left (no lock, and its run may be going on in another pid namespace that shares the directory) waits until nothing of it has changed for a day. Anything else is left, and nothing is followed through a link. Unix only. - A URL read near a heap limit (`ulimit -d`, or a container's) no longer ends the process on signal 6, "memory allocation of ... bytes failed": the HTTP client grows each connection's read buffer with no way to refuse, and sixteen requests in flight on each side took the last of the heap. A read now keeps no more requests in flight than the heap has room for, and a thread started meanwhile leaves that room; with none for one request it is refused, exit 2, with the limit and what to do. - A refusal at the heap limit (`ulimit -d`, or a container's) could end on signal 6, "memory allocation of 8 bytes failed", while it wrote its own message, most often with `--json` and `--export-dir`. The message is now written into room set aside at start, and names the limit and what to do, as the other refusals do. - An `s3://`, `gs://` or `az://` object behind a server that does not answer the request for its end (`Range: bytes=-n`) with a 501, as Fastly does, was asked again ten times, for seconds to minutes, and then failed. It is now read as such an `https://` file is: its start first (under a prefix, its end by its first byte, the listing having given its size), then ranges that name their first byte. A 501 to any store request is no longer asked again: it says the server does not do what was asked. Once a store or an `https://` host has refused it, its next objects are not asked for their end that way: each later object under a prefix saves a round trip. ### Security - A temporary file a run writes and then reads back (standard input, a download, a decompressed input, the files of a directory or a prefix combined, each object of a compressed prefix) is read only while its name is still the file the run made, never through a link. In a temporary directory others can rename files in, another user's file, or a link to one, put at the name after the file was written had been read and compared in place of the input; the run now stops with an error that says so and asks for a `TMPDIR` of the user's own. For the library: `source::open_input` and `source::input_metadata` open an input as the engines do. - What a run writes into its own temporary directories (`sortmerge`'s sorted runs, an export or an output on its way to object storage) is made, read and removed through the directory it created, never by its name: in a temporary directory others can write to, a name swapped for a link or another directory after it was made had sent those files there, and the run's clean-up had removed that directory. A new temporary directory must be this user's, readable by no one else. For the library: `source::upload` takes an open `File` instead of a path. - A URL is shown by its scheme, host and path, with `…` for a password before its host (`http://…@host/`) and for its query string or fragment (`https://host/a.csv?…`), wherever compara names one: errors, the step lines on standard error, `--json` and the report. A presigned S3 or Azure SAS URL, a token in a query string, or a user and password, given as an input, an output or a proxy, had been shown whole; and a request to a signed URL a redirect had sent the input to could show the end of its signature in an error. Object storage URLs (`s3://`, `gs://`, `az://`) carry no credential and are shown as given. ## [0.8.0] - 2026-11-21 ### Added - `-o -` writes the HTML report to standard output, with the counts on standard error, as `--json -` does for the summary (both at once is refused). It replaces `-o /dev/stdout`, which is a link and now refused. ### Changed - An `https://` file is read over HTTP/1.1, a connection to each part, also from a server that offers HTTP/2 (CloudFront and Google Cloud Storage public URLs among them), as `s3://`, `gs://` and `az://` already were: over one HTTP/2 connection every part's TLS and framing ran on one thread. - An output that names one of the inputs is refused before anything is read (exit 2): `-o a.csv`, `--json ./a.csv`, a hard link to A, or an `--export-dir` whose `added.csv` is B would have replaced the input. Paths are compared as files, not as spellings. - A JSON file that names columns with escapes, as Python's `json.dumps` does by default for any name outside ASCII, is compared in under half the instructions where an ignored value differs in every row: such a name is matched by the spelling the file gives it, and the check that a matched row is unchanged reads past it instead of parsing both rows. 200,000 rows with one such name: 3,890.7M instructions to 1,772.9M ([run 44913596938](https://github.com/andrey-usa/compara/actions/runs/44913596938), cachegrind, one thread, against 0.7.0). - In a container (or under `ulimit -d`), a pair whose key indexes cannot fit the heap goes to the sortmerge engine once its rows are counted, instead of after building indexes it then throws away: 10M rows a side under a 512 MB limit, 52.8 s to 35.9 s ([run 44738688220](https://github.com/andrey-usa/compara/actions/runs/44738688220), cold cache, median of five interleaved rounds against 0.7.0). The note says how much the indexes need. Where they fit, nothing changes, also when one file's rows are much longer than the other's. - A JSON file is refused for what comparing it would cost, not for its shape: when its objects times the columns compared pass 17.2 billion cells (2^34) and 256 for each byte of the file. 200,000 objects of 2 of 20,000 keys each (7.7 MB) were refused as "not one table", even with `-c` naming every column; with it they compare in 0.26 s ([run 44738688220](https://github.com/andrey-usa/compara/actions/runs/44738688220), warm cache, median of five). The refusal says how many cells, and names `--compare`. - `-c` (or `-i`, `-k`) naming many columns is checked against the files' headers by lookup, not a search per name: comparing a sparse JSON table with `-c` naming all 20,000 of its columns took 0.87 s and now takes 0.26 s ([run 44738688220](https://github.com/andrey-usa/compara/actions/runs/44738688220), 200,000 objects of 2 keys each, warm cache, median of five, against the build before the lookup: 0.7.0 refuses that table). ### Fixed - An `https://` file is read from a server that does not answer the request for its end (`Range: bytes=-n`, which brings the size with it): every GitHub release asset failed with `HTTP 501`, Fastly's "Unsupported client range", after three more tries, and a server that answered 416 without a size was read as an empty file. compara now asks for the file's start, which says the size, and reads on in ranges that name their first byte, as before in parallel and, for Parquet, only the footer and the columns compared. One that refuses every range is an error naming both requests and what to do. - A server that answered the request for an `https://` file's last 64 KB with a longer span had all of it held in memory, however long: an answer longer than asked is now refused, naming it. - A JSON file framed by its braces (one top-level array, or objects one after another as `jq .` writes them) with anything but space and a comma between two rows was read as some other rows. A stray `]` in a stream of objects ended the rows of the part of the file holding it, so the rows read moved with the thread count (100,000 read as 50,001 at one or two threads, 99,998 at four and up, exit 1); text after an array's closing `]` was dropped, and text after an object was skipped to the end of its line with any object on it (99,999 of 100,000). Such a file is now refused with the line and what to do, at every thread count, as is an object in it that cannot be followed to its closing brace (`[1, 2}`, a number running into a `{`). - A line break inside a string of a later row of newline-delimited JSON (written raw where JSON writes `\n`) ended the row there for the row reader, and the rest of the line was a row with no key: two files differing past the break compared as equal, exit 0. The file is now refused with the line; `json.loads` and jq refuse it too. - An object of newline-delimited JSON broken before its closing brace (a name with no colon, a missing quote, a line cut short at the end of the file) was read as far as the break, and the rest of its line was dropped: its later members compared as absent, or its key did and the row was added and removed. Such a file is now refused with the line, as `json.loads` refuses it. - A JSON member name that is not UTF-8 (a Latin-1 `caf\xE9`, say) was listed with a replacement character but looked up as written, so the column had no values on either side and its changes went unreported with exit 0. Such a file is now refused with the line, the name's bytes and how to convert it (`iconv`); JSON text is UTF-8 (RFC 8259) and Python's `json.loads` refuses it too. - A name repeated in one JSON object now takes its last value for every column, as `json.loads`, JavaScript and jq read it: a key column took its first, so `{"id":9,"id":10}` was row 9 for `-k id` and 10 otherwise, and a later `null` did not clear an earlier value (`{"v":"a","v":null}` against `{"v":"b","v":null}` said changed). A file with no repeated name is read as before, at the same cost. - A JSON key written with an escape was never read: Python's `json.dumps` writes every non-ASCII name that way by default (`"caf\u00e9"`), PHP writes `/` as `\/`. The column was listed but had no values on either side, so its changes went unreported with exit 0, and the same name written plainly on the other side made every row changed. A key is now the name its escapes spell, a key column's included. - A nested JSON value (an object or an array) was compared as written, its spacing included, so the same records pretty-printed and compact compared as changed in every row with one: 133,212 rows changed of 298,486 matched, where the records differ in 2,925 (local). The space between its tokens is no longer part of the value, and a string inside it is read however its characters are escaped (`\u00e9` or `é`, `\/` or `/`), as a top-level string always was. Key order and a number's spelling still count. The report and export show a nested value compact. - The parts of a Hive-partitioned JSON table gave their partition values to every line that opened with a brace: in a pretty-printed part, the objects inside a row's arrays too, and in a part with several objects on a line, the first alone. A row's own object gets them now, after its members. - A URL whose server stopped sending (an answer's headers and then nothing, or no answer at all) held the compare for good, over HTTP and from an object store alike, its progress line counting on. A read now waits 30 s for the answer and for each piece of it, what AWS's Java SDK waits and `curl --speed-time`'s default (`COMPARA_READ_TIMEOUT=` waits longer), then asks again as for a dropped connection; a transfer ends, and says so, once its server has sent nothing on any request for twice that. One request stalled while others are answered, or every request in flight stalled once, still reads through. Object stores wait the same and ask again as they do after any failure, and their reads no longer stop at five minutes a request, which cut off an 8 MB part on a link under 28 KB/s. A server sending 1 KB a second is waited for. Every request stalled, at the default timeout: no end in 150 s to an error at 60.1 s over HTTP and 60.1 s as S3 ([run 44913596938](https://github.com/andrey-usa/compara/actions/runs/44913596938), over loopback, median of three, against 0.7.0). - A plain `http(s)://` PUT -- an output to a presigned URL -- had no time limit: a server that took the connection and then stopped, reading nothing, or reading it all and never answering, held compara for good; and one reading slowly was cut off after 30 s, by the HTTP client's TCP_USER_TIMEOUT, whose count runs on while a receiver's window opens and shuts again. The body is now read from the file as it goes (it was read into memory whole: 1 GiB more held during the upload), and the upload ends once the server has taken nothing for 30 s (`COMPARA_READ_TIMEOUT`) and the time what it may still be reading would take at 16 KB/s, the slowest pace waited for: compara sees only what the sockets take, and they hold megabytes, so a stopped server and a slow one look the same until then. The error says what happened, that compara gives up on a server taking less than 16 KB/s, and what to do. Against 0.7.0 ([run 44913596938](https://github.com/andrey-usa/compara/actions/runs/44913596938), over loopback, median of three): a 19 KB body to a server that reads it and never answers, no end in 150 s to an error at 32.1 s; 398 KB never read, 30.3 s to 55.1 s; 398 KB read at 32 KB/s, done in 12.2 s by both; at 1 KB/s, cut off at 30.3 s before and at 55.1 s now, the floor named. - An output to a URL whose server reset the connection under a body of megabytes killed compara with SIGPIPE, exit 141 and no message (SIGPIPE's default, restored so that `compara head | head -1` ends quietly, caught the socket too). The upload's own error says what happened now, exit 2. - A connection dropped or reset on a URL's first request, for the end of the object (its size, and a Parquet footer), failed the compare: exit 2, "error decoding response body". It is asked again, as every later range is. - A URL's object overwritten part-way through the read, on a server that does not check `If-Match`, was read as one file stitched from two versions: 200,000 rows came out with 23,133 duplicate keys, exit 1. Each ranged answer's ETag, and the object size it gives, are now checked against those of the first, and a change is the same error as a refused `If-Match`: the object changed while it was being read. An answer for bytes other than those asked is asked for again, then an error. - A ranged answer that ran past the range asked (from a server or proxy that ignores where a range ends) was written past it, over the next part where that had come in first: a wrong answer, no error. For the end of the object, whose bytes are placed by their count, all of them landed early: A 199,955 rows of 200,000, exit 1. Such an answer is asked for again, over HTTP and from the stores, and none of it is written. - A JSON file of pretty-printed objects one after another, as `jq .` writes them, was read a line at a time: two objects were six rows, and two such files that differed compared as identical (exit 0). Its rows are now its objects, as a JSON array's are, and so are several objects on one line, where all but the first were dropped. A file read as newline-delimited JSON (its first object on one line of its own) whose later lines are not one object each is refused with the line and how to rewrite it (`jq -c .`); a line that was not an object had been a row with no key. - A Parquet file compared under a heap limit (a container's, or `ulimit -d`) too small for its decoded columns stopped with exit 134 ("memory allocation of ... failed") at most limits between too small to start and enough: 2M rows a side against a CSV, in memory, from 300 to 500 MB. Its reader's allocations are checked now, so the run is refused with exit 2 and what did not fit. Two Parquet files compared by columns did the same where their dictionaries are interned and the report's changed cells are held. - `--engine sortmerge` (and `auto`, where it falls back to it) near its heap limit (a container's, or `ulimit -d`) stopped with exit 134 ("memory allocation of ... failed") at many limits just above the smallest it starts at, as its merge read ahead or its sort filled a batch. A block or batch that cannot grow is now handed on as it is and reused once read, so the run answers as without a limit, or is refused with exit 2 and what to raise. The merge's read buffers, one per spilled run, can still abort below that on files many times the limit. - Where the system refuses a thread (a container's process limit, or a memory limit its stack counts against), the sortmerge and native engines and turbo's streaming join stopped with exit 101 ("failed to spawn thread"); they now do that work on the thread they have, with the same answer. A URL input or output is read and written on that thread too, where it was a panic and exit 101 ("OS can't spawn worker thread"). Where the system gives some threads but not as many as two URL inputs could use, they no longer exit 101, 2 ("reading B panicked") or hang: each thread a transfer reads on is one compara starts itself, and one refused is a thread fewer, with the same answer. Where threads are plentiful, reads are as fast as before. - The names of the JSON columns found past a file's first object are held to one budget for the file, shared by every thread reading it: 64 MB, or a quarter of `--memory` (or of the heap limit) when that is less. Each thread had 64 MB of its own and held each name twice, so a file of long keys took 200 MB of peak RSS at `--threads 1` and 780 MB at 4 before it was refused, whatever `--memory` said; now 137 and 149 MB, and under `--memory 64M` it is refused at 41-52 MB ([run 44738688220](https://github.com/andrey-usa/compara/actions/runs/44738688220), 300 names of 1 MB, warm cache, median of five against 0.7.0). Whether a file's names fit is the same at every thread count: names that every thread's piece meets are counted once, not once a piece. - A JSON key with no value (`"zz":}`, `"q":,`) or no colon names no column, in the first object as in the later ones: the row parser reads no member there, and `compara columns` listed a column empty in every row. - The report, the JSON summary and the export CSVs are written beside their names and moved into place once complete: a run that fails, is stopped or fills the disk leaves the file that was there before, not half of a new one, and a file that is replaced keeps its permissions. A killed run can leave its unfinished `.compara--.part` there, safe to delete. A file the user may write in a directory that takes no new file is written in place, as before. - A file named with `__PAYLOAD__` (or `__MODE__`, `__TITLE__`) in it gave a blank report that said the browser could not decode it: the template's slots were looked for in text already put in, and the payload went into the page title. - The report's "Download shown rows as CSV" quotes a value that holds a carriage return; such a value split its row in a spreadsheet. ### Security - `-o`, `--json` and `--export-dir` refuse a symbolic link at the name of a file they would write (exit 2, saying so) and leave what it points to alone. They wrote through it: in a shared directory (`/tmp`, a CI workspace) a link left at `report.html` turned the run into an overwrite of the file it named. A link at the export directory's own name is refused too. `/dev/stdout` is such a link (`-o -` writes the report there); a FIFO or a device named directly (`/dev/null`) is still written. - The HTML report carries a Content-Security-Policy that forbids it any connection, image, frame or form: it already loaded nothing and showed values as text, and now a value that ever got past the escaping could not fetch, post, beacon or load an image to send the report's data. A script could still navigate the page or open a window to an address that carries it (a policy cannot forbid that), so the escaping stays what keeps scripts out. ## [0.7.0] - 2026-11-17 ### Added - A column only one of the two files has is named in a note after the counts: `note: column only in B, not compared: carrier`. Such a column is not compared, and nothing on the terminal said so: a target that had lost a column compared as identical to its source, exit 0. The note is on standard error and changes no exit code; `-i` naming the column, or `-c` naming the columns to compare, says it is known. The JSON summary lists such columns as before (`meta.only_in_a`, `meta.only_in_b`). ### Changed - Under `--trim`, a value of only spaces or tabs is the empty cell it looks like: `" "` against an empty or missing value is no change. It was a change unless `--empty-is-null` was given too, which surprised most people who asked for `--trim`, since an empty cell is already the same as a missing one in CSV, JSON and Parquet alike. The answer changes for a comparison run with `--trim` alone on such values: they were counted as changed, blanked or filled and are now unchanged. `--empty-is-null` is still accepted, on the command line and in a profile, and changes nothing. ### Fixed - A quote inside an unquoted field no longer joins rows. CSV gives a quote meaning only as the first byte of a field; anywhere else it is content, as in `5" nail`, and `native` and `sortmerge` have always read it so. The turbo engine found the end of a row by counting quotes, so one such quote took every row up to the next one like it as part of its own: a 200,000-row file with an inch mark in every thousandth row was read as 100,000 rows, and against a copy that differed in four of the swallowed rows it was reported identical, exit 0. A row with a quote that opens no field is now read field by field, as the other engines read it. The split of a large file across threads fell back on the same count: its bounds are now checked, and a file they are wrong for is read in one piece (one inch mark ahead of a quoted field of many lines gave 203,217 rows of a 200,000-row file at four threads). Rows with no quote are scanned as before; a row with quotes takes a few more instructions for the check. - Text between a closing quote and the delimiter is part of the value: `"ab"cd` is `abcd`, and `"John "Johnny" Smith"`, from an export that did not double its quotes, is `John Johnny" Smith"`, as `native` and `sortmerge` read them. turbo kept the quoted part and dropped the rest, so two files that differed only after a closing quote compared as identical. A quoted field the file ends in without closing keeps its last byte, which was dropped as if it were the closing quote. - `--delimiter` refuses a quote or a line break, which no reader could split a row on. - A file whose lines end in a carriage return alone is compared: the classic Mac line ending, which Excel still writes as "CSV (Macintosh)". The turbo engine ends a row at a line feed, so it read such a file as one long header line and no rows, and two of them that differed came out as `A 0 rows | B 0 rows`, exit 0. It now declines the file by its first line, and `auto` compares the pair with `sortmerge` (`native` where there is no room for it), which read either line ending, and says so in a note that names the input as it was given. `--engine turbo` says what it met and what reads it. `columns` and `head` read such a file as well. - A JSON file's columns are the keys of every object in it, not of the first. A writer that leaves a null field out of its object (Spark's does, and Go's `omitempty`) leaves the column out of the first object whenever the first row has no value there; that column was then no column, and two files that differed only in it were reported identical, with exit code 0. Newline-delimited JSON and a top-level array are both read so, `compara columns` lists the same columns, in the order the file first shows them on any number of threads, and `compara head` lists those of the rows it shows. Every object's keys are now read once before the compare, which a JSON compare pays for in time; CSV and Parquet are untouched. A file in which no object has a key is refused as that. A file whose objects share almost no keys (every object naming a column of its own) is not one table and is refused as that, in under a second, unless `--compare` names the columns: its cells are the square of its rows. - A table with tens of thousands of columns is read in the time its bytes take. Each column's name was searched for in the list of all of them, so the time grew with the square of the width. - `--delimiter '\t'` and `--delimiter tab` are a tab, on the command line and as a profile's `delimiter`. Only the first character of the value was taken, so `'\t'` split every row on a backslash and `tab` on the letter t, and the run ended on a key column that was "not in A". A value longer than one character is now refused, with the tab's spelling. - `--tolerance inf` and `--tolerance nan` are refused. Infinity made every pair of numbers equal and NaN was no tolerance at all, and neither said so. - `compara head` keeps a row on one line when a value holds a line break or a tab: the aligned table shows it as `\n`, `\r` or `\t` (`--csv` prints the value as it is). A break used to start a new line in the middle of the table. - A Parquet compare whose files fail in more than one column says the same error on every run and every machine: the first failing column in the order the columns are read, the one `--threads 1` reports. The columns are read on several threads, and the error was whichever thread failed first, so one fuzzed file gave "a snappy Parquet page declares 11542724607 bytes" on one run and "unknown type in the parquet metadata" on another (15 of 25 runs at 8 threads; the test that holds it failed on a macOS runner). Columns after a known failure are no longer read. - A profile whose list runs over several lines is read. `key = [` with one name to a line under it, as formatters write a list, was taken a line at a time: an empty key, and the comparison refused for having none. - A profile says what it does not understand. A key it does not have (`ignore_cas = true`, `threads = 4`) and a flag that is not `true` or `false` (`trim = yes`) changed nothing and said nothing, so the comparison ran without the option; each is now refused with its line, and a key one or two letters off a real one with the real one. A profile name that is not in the file is answered with the names that are, and `--config` without `--profile`, which used nothing from the file, is refused. - An option given more than once is no longer half ignored. The first value was the whole answer: `-k order_id -k line_no` compared on `order_id` alone, and the second of two `-o` was a report nobody wrote. The options that name columns (`-k`, `-c`, `-i`) now add up, and any other option given twice with two values is refused by name. - `columns` and `head` look at one file and refuse a second, which was passed over without a word. - The time on the counts line is written to the millisecond; a run under one printed `0s`. - A name that matches a column but for its case, or for spaces around it, is answered with that column: `key column "id" not in A (its columns: "id ", " v"); a name is matched exactly, case and spaces included: there is "id " for "id"`. A header of `ID` or `id ` gave a list in which the name seemed to be there. The same for `--compare` and `--ignore`; a name with a space at either end is shown in quotes. - `--engine native` and `--engine sortmerge` say that a file is not UTF-8 and which engine compares it by its bytes. They answered with a parse error from the CSV reader, after the note that `--encoding latin1` prints to say the counts will be right. ### Security - chrono and humantime, which the cloud reader (object_store 0.14.2, its latest) depends on, are now marked unmaintained by RustSec (RUSTSEC-2026-0543, RUSTSEC-2026-0542). Neither is a vulnerability and neither has a fixed version; both are listed in `deny.toml`, with that reason, so the audits in CI still fail on any other advisory. - Temporary files are the user's alone. compara spools standard input, downloads from object storage, decompressed copies and a table read from many files to the temporary directory, which most machines share between their users, and it made them with the default mode: under the usual umask every user of the machine could read them, a table fetched with the caller's cloud credentials included. The directories it made there were open the same way: the runs the `sortmerge` engine spills, which hold every row of both files, and an export or report on its way to object storage. Files are now made readable and writable by their owner only and directories closed to everyone else, each in one step and only where nothing is, under a name that cannot be guessed from the process id. Windows keeps its temporary directory per user and was not affected. ## [0.6.1] - 2026-11-10 ### Added - `compara skill` prints the agent skill this version carries: how an agent finds the key, reads the counts and the changed columns as JSON, and gets the rows, with the options that change the answer. A test holds every option it names to one `compara --help` lists. ### Security - A snappy page in a Parquet file is held to the size its page header gives before any room is made for it. The stream opens with a length of its own, and the columnar reader took that length's word: a 2.8 KB file whose 11-byte page opened with "11.5 GB follow" had that much address space reserved, and was then refused as out of memory, or as a page that would not decompress, depending on the machine. It is now refused at once as what it is (`a snappy Parquet page declares 11542724607 bytes where its header says 11`), and a length that the stream's bytes could not expand to (64 bytes from every three is the format's most) is refused before the header is asked. Found by the nightly fuzz job ([run 42802471876](https://github.com/andrey-usa/compara/actions/runs/42802471876)); the file is `tests/fixtures/hostile/snappy_length.parquet`. - Keys built to share one hash made a compare quadratic: every engine hashed keys with a fixed FNV, and a file whose keys cancel each other's words put every row in one probe chain, so the work grew with the square of the rows (`tests/hostile.rs` builds such keys). Keys are now hashed by a full 64x64-bit multiply, folded, by a multiplier and from a start chosen at random for each run, so they can't be built to collide. Results are the same as before, byte for byte, and no slower: turbo takes 3.0% fewer instructions at 50k rows and 2.4% fewer at 200k than 0.6.0 does with this and the 32-bit hash below (cachegrind, [run 42703350843](https://github.com/andrey-usa/compara/actions/runs/42703350843)). `COMPARA_HASH_SEED` fixes the keys for a run that must repeat exactly (a benchmark). ### Changed - On a CPU with AVX-512BW the turbo engine's CSV scan steps 64 bytes at a time instead of 32, chosen at run time, so the released binaries reach it without being built for it; AVX2, NEON and the portable scan stay as they were, and the output is the same byte for byte. Where memory bounds the scan it changes nothing: on a GitHub runner with a Xeon Platinum 8573C a 2M-row CSV pair compares in 0.215 s against 0.211 s before (median of 7, [run 42764485535](https://github.com/andrey-usa/compara-polyglot-experiments/actions/runs/42764485535)). On two machines where the CPU bounded it, the two CSV sweeps took less than half their time before (indicative: measured outside CI). - On arm64 the turbo engine's CSV scan packs its 32 compare bytes into a mask with three pairwise adds and one lane read, where it took four horizontal adds; same mask, same output. A 2M-row CSV pair compares in 0.172 s against 0.196 s before on GitHub's arm64 runner (median of 7, interleaved), with 11.0% fewer instructions (cachegrind; [run 42772693608](https://github.com/andrey-usa/compara-polyglot-experiments/actions/runs/42772693608)). - A gzip or zstd input is expanded into memory on Linux while it fits a quarter of the memory free (inside a container, a sixth of the heap limit, which it then comes out of), and to `TMPDIR` past that. A 10M-row `.csv.zst` pair compares in 3.03 s on a 4-core runner, with the same counts as DuckDB (best of 3, the `zstd` job of bench-contenders, [run 41494922719](https://github.com/andrey-usa/compara/actions/runs/41494922719)). - The sortmerge engine sorts each batch by an eight-byte key prefix held beside the row number, reading the key text only on a tie; same output. With the spill record below, sortmerge takes 30.9% fewer instructions at 50k rows and 30.1% fewer at 200k than 0.6.0 (cachegrind, [run 42703350843](https://github.com/andrey-usa/compara/actions/runs/42703350843)). - The turbo engine keeps each row's key hash in 32 bits rather than 64 (it only ever filtered candidates; the key bytes decide), and frees the duplicate-key counts once the duplicate sections are written: 1.9% fewer instructions at 50k rows and 0.9% fewer at 200k (cachegrind, [run 40973415500](https://github.com/andrey-usa/compara/actions/runs/40973415500)); same output. - The sortmerge engine's spilled runs hold each row as one record (its length, a length per cell, then its text), read back in two reads and checked once, where each cell was read and checked on its own: about a quarter fewer instructions: 24.3% fewer at 50k rows and 23.4% fewer at 200k with runs forced to spill (cachegrind, [run 40996649319](https://github.com/andrey-usa/compara/actions/runs/40996649319)); runs on disk about the same size; same output. A damaged run (cut short, lengths that don't add up, text that isn't UTF-8) is an error. ### Fixed - A file with two columns of the same name was compared with one of them left out and no word about it; it is refused now, naming the side and the column (`A has two columns named "id"`), unless `-i` or `-c` leaves that column out. A name repeated inside one JSON object is still one column, its last value; unnamed columns (a header ending in commas) are not repeats. - `--encoding` was accepted and ignored. Latin-1 and the Windows code pages still compare correctly as bytes and now say so in a note; UTF-16 and UTF-32, which can't, are refused with how to convert, as is a name that isn't an encoding. A UTF-16 file is recognized by its byte-order mark instead of failing on a header of noise. - A key that isn't in a file says which side lacks it and what columns that side has, without "the turbo engine failed" before it: nothing failed. - Delta-encoded Parquet integers whose deltas need more than 32 bits (an INT64 column with large jumps between rows) lost their high bits and were read as wrong values; they are read whole now. - At a tight heap limit (a container's, or `ulimit -d`) a run could abort (SIGABRT) instead of refusing with exit 2: while one side's checked allocation met the ceiling, the other side's thread could meet it with a small one. The reserve kept for the refusal now covers that too; a test holds it (`the_band_where_it_aborts_does_not_grow`, green on Linux, ARM, macOS and Windows in [run 40372192496](https://github.com/andrey-usa/compara/actions/runs/40372192496)). ### Changed - Messages say what happened in plain words: - an option compara doesn't have is named as unknown (`--bogus` used to be reported as needing a value), and an unknown command names the commands there are in one line instead of printing the whole usage; - an empty file, a UTF-16 file and a binary file are each said as what they are, by every command and engine, instead of a strange column name and a missing key; - a cloud read with no credentials starts with what to set, and the store's retry log is left out; a URL that can't be reached says why (the host name does not resolve, nothing answers on that port, no answer within 30 s) and that a proxy is set when one is; - exit 3 says it came from `--fail-on-dups`; - a Parquet file that can't be read says so (`reading the Parquet files: …`) instead of "the turbo engine failed"; - standard input and a decompressed file are named as given (`standard input is empty`, `e0.gz is empty`), not as the temporary copy read; - a pipe or process substitution given as a file (`<(…)`) says to pipe into `-` instead; - a `--delimiter` that isn't in a file's header says so, and what the header has, instead of quietly reading every row as one column. - The counts line labels what it shows: `duplicate keys A 0, B 1 | engine turbo, 0.4s`, and `1 row` is singular. The HTML report says `engine turbo` and `1 row` too, and its tab title and heading agree. - `--help` fits 80 columns, describes every option, and says what the three engines are for. ### Security - Through a proxy (`HTTPS_PROXY`), a table at a name that leads to a cloud metadata address (a hosts entry or DNS name for 169.254.169.254), or at a metadata service's own name (`metadata.google.internal`), was read: the proxy looked the name up, past compara's check. The name is looked up before the request goes to the proxy, and refused like the address (`COMPARA_ALLOW_LINK_LOCAL=1` allows it); so is a redirect to one. A name only the proxy can look up still goes to it. Found by red-teaming the 0.6 check. - A Parquet page that claims more values, or more uncompressed bytes, than its stored bytes can hold by the decompression-bomb rule (past 1 GB, more than 1000 times) is refused before anything is sized from it (`COMPARA_MAX_EXPANSION`). Found by fuzzing: a 9.7 KB file had 2.8 GB reserved for a page that claimed 1.47 billion values. - A Parquet page that claims a bit width wider than its values (found by fuzzing) is refused with a message; a debug build panicked on it and a release one read garbage. - A gzip or zstd input that expands past 1 GB to more than 1000 times its size is refused as a decompression bomb; it was expanded whole into `TMPDIR` first (`COMPARA_MAX_EXPANSION=`, 0 for no limit). - `http(s)://` inputs and their redirects no longer reach link-local addresses (cloud metadata services: 169.254.169.254, fe80::/10, fd00:ec2::254), by address or by name (`COMPARA_ALLOW_LINK_LOCAL=1` allows it); redirects stop after 10, and a refused one says why. ## [0.6.0] - 2026-10-26 Tables compared where they are: in S3, Google Cloud Storage and Azure, on the web, as directories and globs of parts, and as Delta Lake tables at a version. A container image and a GitHub Action. Faster on every format, and inside a container's memory limit a refusal that says why rather than an OOM kill. ### Added - Inputs from object storage and the web: `s3://`, `gs://`, `az://` (and `adl`, `azure`, `abfs`, `abfss`), `http://` and `https://`, wherever a file is accepted. Credentials come from each cloud's own environment -- `AWS_*` and `~/.aws` profiles (keys, session tokens, `AWS_ENDPOINT_URL` for MinIO and the like, web identity for EKS, ECS task roles, instance metadata), `GOOGLE_*` and application default credentials, `AZURE_*` (account keys, SAS, service principals, managed and workload identity) -- and a presigned or SAS URL is read as it is. Objects are read in 8 MB ranges, sixteen at a time (`COMPARA_FETCH_CONCURRENCY`), into a temporary file. A Parquet object is read only as far as the comparison reads it: its footer and the column chunks of the key and compared columns, so `--compare` on two columns of a wide table fetches those two. `columns` on a remote Parquet file reads its last 64 KB. The `cloud` feature is on by default; without it the binary reads local files only. Every range is read from the version whose first bytes were read (`If-Match` on its ETag), so an object overwritten mid-read is an error rather than a file stitched from two versions; throttled and failed ranges are retried. A plain HTTP server that ignores ranges sends the object whole; it is written to disk as it arrives (the temporary directory's room checked first), never held in memory. - A download that takes a while says how far it has got every ten seconds on stderr, so a CI job's or a pod's log shows it moving (`COMPARA_PROGRESS` sets the seconds; 0 turns it off). - Outputs to the same places: `-o`, `--json` and `--export-dir` take an `s3://`, `gs://` or `az://` URL (or a presigned `https://` one), written in one request or as a multipart upload of 16 MB parts. `--json -` prints the summary on standard output, and the counts line goes to standard error, so a pipeline or a CI step reads one JSON document. - A directory, a quoted glob (`'out/date=*/*.parquet'`, `**` for any depth) or an object storage prefix (`s3://bucket/orders/`, or the same without the slash when no object has that name) is a side: its files, read as one table in path order. CSV and TSV parts must share a header, Parquet parts a schema (names, order, types, nullability), and the error names the part and the difference; compressed parts are expanded on the way. Remote parts are fetched with sixteen ranges in flight across all of them, Parquet parts only as far as the comparison reads them. Hive partition directories (`date=2026-10-01/`) are columns of the table, as text, unless the files already have them: a Parquet part gets a column chunk of one dictionary value per row group, a CSV or JSON part the value in every row. `.`- and `_`-prefixed names are passed over; Iceberg tables are refused. - Delta Lake tables, local or in object storage, at their latest version or at `@vN` (`s3://lake/orders@v41`): the files the log says make that version, from its last checkpoint and the commits after it, so two versions of a table compare like two tables. Deletion vectors, column mapping, V2 checkpoints and a log cleaned up past the version asked for are refused with what to do instead; a Delta table further down a directory is named rather than read as loose files. - Credentials as each cloud's own tools find them, laptops included: an AWS profile that uses SSO, an assumed role or a `credential_process` is resolved as the AWS CLI resolves it; an `az login` is used when Azure has nothing else; and with no credentials at all a public bucket is read unsigned rather than refused. - `--exit-zero`: exit 0 when the tables differ, for a scheduled job whose output is the report -- a Kubernetes Job, an Airflow task -- where exit 1 would mark the run failed. - `-` for either file reads standard input. - Gzip and zstd files are read as what they hold, by their first bytes rather than their names (`.csv.gz`, `.ndjson.zst`); bzip2, xz and zip are named and refused rather than read as a CSV. - `compara env`: the CPUs, memory, container limit, heap limit and temporary directory this process sees, with the room left in it, and where each cloud's credentials would come from (keys, a profile, web identity, a CLI sign-in, metadata) -- by what is set, nothing fetched. A download or a table of parts that the temporary directory has no room for is refused before it starts, with how much it needs and where. - A container image, `ghcr.io/andrey-usa/compara`: the release binary on distroless for `linux/amd64` and `linux/arm64`, non-root, with build provenance and an SBOM. - A GitHub Action (`uses: andrey-usa/compara@v0`): installs the release binary, compares, writes the counts and the most-changed columns to the job summary, and fails the step on differences; its outputs are the counts and the JSON summary's path. ### Changed - A closed pipe ends the process quietly, as it ends `cat`: `compara head big.csv | head -1` used to print an internal error. - Faster on every format and thread count. On 2M-row pairs, 4-core GitHub Actions runners, best of five (CI run 39728278163), the time against the C port of the same tool: CSV 0.75x at one thread and 0.83x at four, TSV 0.74x and 0.81x, NDJSON 0.52x and 0.67x, Parquet 0.57x and 0.73x. - Quoted CSV: the row end and the join's register count follow quotes by parity, a register at a time, instead of a scan per quoted field and a field walk per quoted row. On the same 2M rows with their text fields quoted, 0.61x the C port's time at one thread and 0.63x at four (CI run 39729954571). - Parquet: the join reads each key column through a form settled once per column, and compares short keys by a load or two instead of `memcmp`: the match sweep runs in half the instructions. - Buffers of 4 MB or more are advised onto transparent huge pages, so filling them takes a page fault per 2 MB rather than per 4 KB: on the 2M-row Parquet pair 75,651 faults become 16,889. - NDJSON rows are proved equal before they are parsed, and the CSV join's register count, key hash and index insert do less per row. - Inside a container with a memory limit, the heap is held under that limit (`RLIMIT_DATA`, a sixteenth below it), so running out of memory is a refusal that says what needed how much -- exit 2 -- rather than an OOM kill with no message (exit 137). Under `--engine auto` a CSV pair whose indexes do not fit is then compared by the `sortmerge` engine, which spills to disk, with the same answer. `COMPARA_CONTAIN=0` turns this off. In a container, files being written -- spilled runs, downloads, expanded gzip -- are handed to the disk as they go rather than left dirty in the page cache, where they count against the same limit: a 160 MB container whose heap stayed under 120 MB was OOM-killed by them. - `sortmerge` sizes its batches from the heap it may have, and builds the report's rows only when there is a report: a summary run of a 2M-row CSV pair now completes in a 40 MB heap (`ulimit -d`), where it failed in 100 MB. Named with `--engine sortmerge` in a heap under 24 MB, it is refused before it starts rather than aborted midway; under 48 MB `auto` doesn't fall back to it on its own, and its refusal says that `--engine sortmerge` tries it. - The README has a table of comparisons read from S3 against DuckDB's `httpfs` (CI run 39793328982): at 10M rows a side, 2.7 times faster on a Parquet pair, 2.8 on CSV, 6.0 on a table of Parquet parts, in a third to a half of its memory. - The README's speed table is rerun on this code (CI runs 39728430053 and 39729034092): at ten million rows and four threads, CSV 1.20 s to 1.08 s, NDJSON 2.79 s to 1.26 s, Parquet 1.41 s to 1.17 s. Its input column was labelled "a side" but held both files; it says so now. ## [0.5.3] - 2026-10-22 Two Parquet files compared up to 2.5 times faster, JSON files that are one top-level array, and two silent wrong answers on JSON input fixed. ### Added - A JSON file can be one top-level array of objects, compact or pretty-printed, as well as one object per line: the rows are the array's objects and the columns the keys of the first one. Newline-delimited JSON reads as fast as before. ### Fixed - A JSON value that is an object or an array was read as absent, so two different nested values compared as the same missing value and the change went unreported (0.5.2 and earlier). It is now compared as its JSON text, as written, and the report and export show that text. The README says what that means for key order and spacing, and when to flatten first. - A pretty-printed top-level JSON array whose rows hold objects on lines of their own lost rows when read on several threads: a split guessed at the next line opening an object could land inside a row, and the rows read from there were dropped without a word (200,000 rows counted as 100,718 at four threads). Splits are now checked as CSV splits are, and redone on bounds that follow the array's depth when a guess was wrong; the guess itself takes the column the first row opens at. Top-level arrays were new in 0.5.3-alpha.1; 0.5.2 did not read them. ### Changed - Two Parquet files compare faster on the columnar path. Snappy pages are expanded with whole-word copies; a column's row groups are read in runs on threads of their own, both sides at once, so a file with fewer columns than cores no longer leaves cores idle; a slot of the key index holds its row, so a match costs one cache miss less, the cells a probe compares are prefetched, and integer, date and other word keys are hashed a column at a time; the compared columns go largest first and each is compared on several threads; the footer is parsed once per file. In CI (run 39468615515, a 4-core runner, a 5M-row pair written by pyarrow, counts only) the comparison took 1.26 s at one thread, 0.79 s at two and 0.56 s at four, against 2.34 s, 1.53 s and 1.40 s for 0.5.3-alpha.1; DuckDB took 6.73 s, 3.94 s and 3.13 s and Polars 4.98 s, 3.32 s and 2.73 s on the same runner. With the changed rows written out: 1.29 s, 1.09 s and 0.72 s, against 2.43 s, 2.19 s and 1.90 s. Answers are the same; a footer the row-group runs cannot trust is read in one pass, as before. - `--export-dir` on two Parquet files keeps the decoded compared columns for the export when the memory budget has room for them, instead of reading each column a second time. - The key index is built on one thread unless `COMPARA_PARALLEL_INSERT` is set: the parallel build, taken from 1M rows on, measured slower. - Each occupied slot of the key index is ranked with one POPCNT per key where the CPU has it, chosen at run time. - `COMPARA_PHASES=1` also prints each compared Parquet column's read and compare times. - The README lists TSV and JSON as input formats of their own, with how each is read: TSV through the CSV reader, JSON as one object per line or one top-level array of objects, its columns the keys of the first object. ## [0.5.2] - 2026-10-16 ### Added - `compara-gen-data --format tsv` writes the CSV rows tab-separated, so a TSV pair can be benchmarked against the same rows in CSV. On a 1M-row pair TSV is within 5% of CSV on every engine (`turbo` 0.15 s against 0.14 s, `native` 1.33 s against 1.28 s, `sortmerge` 2.07 s against 1.98 s, four threads) and gives the same answer and export files, which `tests/formats.rs` now holds every engine to. ### Changed - On x86-64 the CSV, TSV and NDJSON readers scan with AVX2 when the CPU has it, asked at run time, so the release binaries and `cargo install` get the vector scan that before needed a build made with `-C target-cpu=x86-64-v3`. On a 2M-row pair, four threads, CSV counts in 0.24 s against 0.28 s (paired 1.16x), TSV 1.19x, NDJSON 1.02x, level with the x86-64-v3 build on all three; answers and export files are the same, byte for byte. A CPU without AVX2, and aarch64, scan eight bytes at a time as before. - `--export-dir` on two Parquet files runs on the columnar path. Before, it stopped with "--export-dir is not supported on the parquet path" unless `--engine turbo` was given, which reads the files row by row: on a 1M-row pair with 60,000 changed rows that took 1.48 s and 766 MB, now 0.31 s and 363 MB; at 5M rows 11.3 s and 3.8 GB, now 1.8 s and 1.7 GB. The files are the same, byte for byte. - `--export-dir` without `-o` no longer gathers the report's rows, which nothing then reads. - Two Parquet files compressed with gzip, zstd or LZ4 are compared on the columnar path, as snappy and uncompressed ones were. Before, any of them sent the pair through the row-by-row reader, and zstd is what polars writes by default: a 2M-row pair it wrote took 1.14 s at two threads, now 0.39 s, what the same pair written with snappy takes. ## [0.5.1] - 2026-10-14 ### Changed - `compare` writes the HTML report only with `-o`/`--out`. Without an output flag it prints the counts and writes nothing; before, it wrote `__vs__.html` into the working directory. `--json` and `--export-dir` write their files on their own, and `--no-compress` without `-o` is an error. - `--engine sortmerge` or `--engine native` on a Parquet or JSON input exits 2 with a message. Before, a Parquet pair took the columnar path anyway and the report said `parquet`. - `--memory` and `COMPARA_MEMORY` apply to two Parquet files: they decide how many columns are read at once, and a pair that needs more than a stated budget is refused before anything is read. Before, the columnar path ignored them. - Two Parquet files with boolean, integer, float, date, time, timestamp or decimal columns are compared on the columnar path, a word per value. Before, one such column sent the pair through the row-by-row reader: a 1M-row file written by DuckDB took 1.9 s and 4.5 s of CPU, now 0.4 s and 1.0 s. - `native` holds rows packed and indexes keys without copying them: a 1M-row pair took 27 s and 2.9 GB, now 1.6 s and 0.7 GB; 10M rows take 33 s and 6.7 GB, where 72 s and 25.7 GB were reported. - `sortmerge` reads and sorts the two files at once and merges with a heap: a 1M-row pair took 9.8 s, now 2-3 s; 10M rows 209 s, now 35 s, in 260 MB. ### Fixed - A CSV or JSON side compared with a Parquet side showed changed cells that held the same value: `31.40` against the DOUBLE 31.4, `12345` against the DECIMAL 12345.00, `2026-09-01 02:15:00` against the timestamp `2026-09-01T02:15:00`. A column Parquet stores as numbers now compares by exact value, and a temporal one by instant; a 100k-row CSV against its own Parquet export went from 100,000 changed rows to none. - A UTF-8 byte order mark at the start of a CSV or NDJSON file became part of the first column's name in the default engine (`key column(s) missing`), and made an NDJSON file read as CSV. - The weekly contender benchmark now holds DuckDB and pandas to compara's counts on the same question: it counted duplicate keys per row, read empty strings as NULL and did not map `unchanged`. Hostile Parquet and NDJSON files are refused with exit 2 and a message, where before a few bytes could crash or exhaust the process (found by mutation fuzzing; each case is a test in `tests/hostile.rs`): - a zstd page whose stream expands past its header's size was decompressed in full first: a 133 KB file used 8 GB of memory. Decompression now stops one byte past the declared size (zstd, gzip, snappy, LZ4). - a footer nested 200,000 structs deep overflowed the stack; nesting past 64 levels is refused. - a list count larger than the footer could hold sized an allocation of up to 100 GB (abort) or, for lists of bools, looped for hours. - a string length, page size or value count near 2^64 or negative wrapped the bounds checks and panicked. - a `DELTA_BINARY_PACKED` header claiming a 10^16-value miniblock, and an RLE run of billions of values, were materialized up front (abort). - an NDJSON file cut off right after a key's opening quote panicked `head` and `compare`. - `--no-compress` reports: a value holding ` # Contributing How to build, test and benchmark compara, and the performance gate every change passes. Bug reports and pull requests are welcome. For anything larger than a fix, open an issue first so we can agree on the approach. ## Build and test ```sh cargo build --release cargo test --release cargo fmt --check cargo clippy --all-targets --all-features -- -D warnings ``` A cold build takes about twenty seconds. The tests assert one result contract across every engine and every input format, cell for cell: a change that makes two engines, or a CSV and a Parquet copy of the same rows, disagree fails them. ### The toolchain `rust-toolchain.toml` names the rustc that CI, the perf gate, the benchmarks and the release workflow build with, and rustup installs it for any `cargo` run in the checkout (`cargo +stable ...` builds with another). A new rustc moves instruction counts with no change to the code, so the perf gate, the benchmark results and each release's notes name the rustc that built every binary they measure or ship; `scripts/buildinfo.py ` reads it from a Linux binary. Compare counts from one compiler only. The version moves in a pull request that changes nothing else; Dependabot opens one when a new rustc is out. Its perf gate builds both sides with the new rustc, then the head with the base's, and prints what the compiler alone moves under "The compiler alone"; that table goes in the pull request and in the next CHANGELOG. `rust-version` in `Cargo.toml` (the oldest Rust that builds compara, checked by ci's `msrv` job) does not move with it. ### Test data ```sh cargo run --release --bin compara-gen-data -- --rows 1m --out-dir data cargo run --release --bin compara-gen-data -- --rows 1m --out-dir data --format parquet compara compare data/1m_a.csv data/1m_b.csv -k account_id,txn_id -i updated_at ``` `compara-gen-data` writes a deterministic 20-column pair keyed on `(account_id, txn_id)`, as CSV, newline-delimited JSON or Parquet, from one recipe. Money is carried in integer cents and drifted as integers, so the files are byte for byte reproducible: | Drift | Share of rows | |---|---| | `status` changed | 3.0% | | `amount` changed (+12.34) | 1.5% | | `balance` changed (+1%, half up) | 1.5% | | `value_date` blanked | 0.3% | | `updated_at` changed | 100% (excluded with `--ignore`) | | rows only in B | 0.10% | | rows only in A | 0.10% | | duplicate keys | 0.01% per file | The small files in `tests/fixtures/` are written by pyarrow, not by this project (a reader tested only against its own writer's files tests nothing); `tests/fixtures/README.md` says what each one is for, and `scripts/` holds the scripts that write them. ### Benchmarks ```sh cargo run --release --features bench --bin compara-bench -- --rows 1m --engine turbo --out-dir bench ``` `compara-bench` runs the comparison in a child process so peak RSS is measured honestly, records generation time, wall time, throughput, report size and counts, and fails when a scale exceeds its budget. Compare numbers from one machine and one sitting only. ### The performance gate Every pull request counts the instructions `compare` takes, for each engine, on 50k and 200k generated rows a side, and with turbo on 200k rows of NDJSON written compactly (`--format ndjson`) and as Python's `json.dumps` writes them by default (each line loaded and dumped again: `, ` and `: `), at its head and at its base: ```sh python3 scripts/perf_gate.py --head target/release/compara --base /path/to/base/compara \ --small 50k_a.csv 50k_b.csv --large 200k_a.csv 200k_b.csv \ --json 200k_a.ndjson 200k_b.ndjson --json-spaced 200ksp_a.ndjson 200ksp_b.ndjson \ -- -k account_id,txn_id -i updated_at ``` It fails when a count rises more than 5% over the base's, when four times the rows cost more than 5.5 times the instructions (linear and n log n work sits at 4.0-4.2, quadratic at 16), or when the spaced NDJSON costs more than 1.1 times the compact in the head (about 1.04 when each spaced row is read as a compact one is; about 2 when it is not). A count repeats to a few hundredths of a percent where a time on a shared runner varies by two or three times, so the bounds can be tight. `scripts/icount.py` counts one command: with the processor's counter where the kernel offers one, else with valgrind (exact, about 25 times slower); compare counts from one counter only. A change that is meant to cost more says so in its description. ### Diagnostics | variable | effect | |---|---| | `COMPARA_PHASES=1` | print where the time went, phase by phase | | `COMPARA_PRINT_PEAK_RSS=1` | print peak memory at exit (Linux) | | `COMPARA_MEMORY=` | the memory budget, as `--memory` | | `COMPARA_BACKTRACE=1` | a backtrace on panic | ## Layout ```text src/main.rs argument parsing and exit codes src/lib.rs the library's public surface src/contract.rs the result contract src/options.rs runtime parameters and engine names src/engine.rs compare() entry point and the engine registry src/engine/turbo.rs the byte-level engine: threading, the index, the join src/engine/turbo/ field packing, SWAR and AVX2 scans, CSV/JSON readers, the Parquet reader src/engine/pqdiff.rs the columnar path for a Parquet pair src/engine/sortmerge.rs external sort and merge join src/engine/native.rs csv-crate parse, in-memory join src/report.rs, report.html the HTML report and its embedded template src/profiles.rs compara.toml profiles src/gendata.rs the test data generator (and src/gendata/parquet.rs, its writer) src/bin/ compara-gen-data and compara-bench tests/ the contract, every engine and format, out-of-memory behaviour ``` ## Releasing 1. Bump `version` in `Cargo.toml` and add a `CHANGELOG.md` entry on `main`. 2. Actions → release → Run workflow with that version. The run checks the version, builds every target, tags `v`, creates the GitHub release and publishes to each registry that is switched on. Registries are switched on per repository with Actions variables, once the account and trusted publisher exist: | variable | publishes to | trusted publisher to configure | |---|---|---| | `PUBLISH_CRATES=true` | crates.io | crate `compara`, workflow `release.yml` | | `PUBLISH_NPM=true` | npm (`compara` + one package per platform) | each package, workflow `release.yml` | | `PUBLISH_PYPI=true` | PyPI (platform wheels) | project `compara`, workflow `release.yml`, environment `release` | | `HOMEBREW_TAP=owner/homebrew-tap` | Homebrew formula | secret `TAP_TOKEN` with write access to the tap | | `SCOOP_BUCKET=owner/scoop-bucket` | Scoop manifest | the same `TAP_TOKEN` | Re-running the workflow for a version that already exists rebuilds its files and publishes it to any registry that doesn't have it yet. --- Made from [CONTRIBUTING.md](https://github.com/andrey-usa/compara/blob/main/CONTRIBUTING.md). # Security What compara protects and how, and how to report a problem. compara parses untrusted CSV, JSON and Parquet files, and its Parquet reader decodes pages itself. Any input that makes it crash, hang, read out of bounds or report a wrong count is a bug we want to hear about. ## What to expect - A malformed or hostile file should end the run with exit 2 and a message; a panic, an abort or a hang is a bug. `tests/hostile.rs` holds one file per way this has failed before (deep or oversized footers, wrapping lengths, decompression bombs, truncated rows), and CI runs it on every push. - No `unsafe` code depends on the file's contents: the `unsafe` blocks are SIMD loads behind bounds checks, prefetches, a `set_len` after the writes it covers, and the memory map. - Memory grows with the row counts a file declares. A valid Parquet file can describe a billion equal values in a few kilobytes, so a small file is not a small comparison; run untrusted inputs under a memory limit (`ulimit -v`, a container) if that matters. - A gzip or zstd input that expands past 1 GB to more than 1000 times its size is refused (`COMPARA_MAX_EXPANSION`), and so is a Parquet page that claims that many values or bytes from what it stores; an `http(s)://` input or redirect that leads to a link-local address (a cloud metadata service) is refused (`COMPARA_ALLOW_LINK_LOCAL=1`), through a proxy too: the name is looked up before the request goes to the proxy. Other private and loopback hosts stay readable: they are where many tables live. - What compara writes to the temporary directory (`TMPDIR`) is for the user who ran it alone: a spooled standard input, a download, a decompressed copy, the runs `sortmerge` spills, an export on its way to object storage. Files are made with mode 0600 and directories 0700, never at a name that already exists, and removed when the run ends. A file or directory a killed run left there is removed by the next run that makes one, when it is provably compara's and over: compara's own name, this user's and closed to others, not a link, a file with no other name, only compara's files in a directory and no link, not locked by a live run, its process gone, and nothing of it changed for a minute; a day for one an earlier version left, which no lock protects (Unix). - The files a run is told to write (`-o`, `--json`, `--export-dir`) are written only at the names given: a symbolic link at one (or at the export directory) is refused, not followed, a name that is one of the inputs is refused before anything is read, and each file is written beside its name and moved onto it once complete. A device (`/dev/null`, `NUL`) and a file at a name that takes no new file or no rename (a directory the user may not add to, another user's file in a sticky directory, a file mounted at the name) are written in place instead: a run that fails there can leave the file half written, and its error names it. - The HTML report shows cell values as text. It loads nothing from the network and runs no code from the data, and its Content-Security-Policy forbids it any connection, image or form, so a value that got past the escaping could not fetch, post or load anything. It does not stop a script from navigating the page or opening a window to an address that carries data: the escaping is what keeps scripts out, the policy a second layer. - Exported CSVs (`--export-dir`, the report's download) keep values exactly as they were. A value beginning with `=`, `+`, `-` or `@` is a formula to a spreadsheet application: open untrusted exports as text. - Writing a file you are comparing while compara has it mapped can end the run with SIGBUS; compare a copy of a file that is still being written. ## Reporting Please report vulnerabilities privately through [GitHub security advisories](https://github.com/andrey-usa/compara/security/advisories/new) rather than a public issue. Only the latest release receives fixes. --- Made from [SECURITY.md](https://github.com/andrey-usa/compara/blob/main/SECURITY.md).