Skip to content

feat(api): Parquet export format for duplicate groups (#1252) - #1279

Merged
athvin merged 1 commit into
mainfrom
feat/1252-duplicates-parquet
Nov 26, 2026
Merged

athvin merged 1 commit into
mainfrom
feat/1252-duplicates-parquet

Conversation

@athvin

@athvin athvin commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Closes #1252

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

format: parquet now works for duplicate groups. Each group is one row, and its members are a nested List<Struct<key, confidence>>. The golden preview is one golden struct. The Arrow schema is declared up front from the typed PersonDuplicateGroup / AccountDuplicateGroup (DuplicateGroups::arrow_schema), and batches are built straight from those structs (DuplicateGroups::to_record_batch), never through JSON. ExportRequest::from_params now refuses only duplicates as CSV.

Why

#1241 left duplicates as JSON Lines only, because inferring a schema from page one breaks when a nullable field first carries a value on a later page. A schema declared before the first page avoids that.

Proof

  • make check: pass (exit 0, run from the repo root on this head; an earlier run hit a pre-existing er-cli flake, see the ledger)
  • DEDUPE_E2E_DUCKLAKE=1 cargo test -p er-server --test main export_write (the lake-backed case in make check-e2e): pass. R's three account groups at page size 2 come back as three rows, and each row's members, member confidences, group confidence and company name match the JSON Lines export. An empty lake gives a readable zero-row file.
  • New unit test exports::tests::duplicates_round_trip_through_parquet_across_a_page_boundary: three pages, with page one's group_confidence, master_record_key, member confidence and golden.email null on every row, an empty page, and page three setting them all. The file read back has the declared schema, one row per group, and the nested members.

Risk & rollback

This is additive: JSONL and the CSV refusal (still 422) are unchanged. Rollback is git revert <merge-sha>.

Post-merge ledger

Closed by: unclosed

  • main is green with this change on it — the merge SHA, and the run
    that proves it. A later head SHA with this commit as an ancestor counts;
    a cancelled run with zero jobs does not:
  • images built, or correctly never ran because nothing that goes into
    an image changed:
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion:
  • the push-only surface no pull request can pre-test (deploy, drift,
    kind's nightly leg) is green, or knowingly red for a reason that is not
    this change:
  • the board card reached Done through the automation rather than by
    hand, and the issue closed:
  • follow-ups are open for everything deferred here — numbers:
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned:

Specific to this change

  • er-cli's cli::tests::dictionary_rows_match_server_canonical_forms_and_hashes flaked once in the local make check (about 1 in 3 runs in isolation). Its two parallel tests can build the same temp path from pid plus nanos. This predates the change and the diff doesn't touch it. File a ticket if it shows up in CI.
Context — plan, discoveries, measurements, files

Discoveries

  • Members fold the JSON's member_confidences map into the list it is keyed by: {key, confidence}, with confidence null for an unscored member. This is the List<Struct> the ticket asks for.
  • The request schema in the OpenAPI contract carries no field descriptions, so the contract does not change. Only the ExportIn doc comment and the ExportFormat docs changed.
  • I also removed a stray doc line from E11.3b — Parquet export format #1241 that had attached "Walk every golden page" to LINEAGE_COLUMNS.

Files

  • rust/crates/er-server/src/read.rs: DuplicateGroups::arrow_schema / to_record_batch, plus helpers
  • rust/crates/er-server/src/exports.rs: DuplicatesParquet writer, duplicate_pages, the lifted refusal, unit tests
  • rust/crates/er-server/tests/export_write.rs: case 8, duplicates Parquet over a real lake
  • rust/crates/er-server/src/lib.rs: ExportIn.format doc

🤖 Generated with Claude Code

format: parquet now exports duplicate groups, one row per group. The Arrow
schema is declared from the typed PersonDuplicateGroup / AccountDuplicateGroup
before the first page (DuplicateGroups::arrow_schema), so a nullable field that
is null on every row of page one keeps its type when a later page sets it.
Batches are built from the typed groups directly, never through their JSON:
members is List<Struct<key, confidence>> (member_confidences folded into the
list it is keyed by), the golden preview one `golden` struct.

ExportRequest::from_params now refuses duplicates only as CSV.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@athvin
athvin merged commit 84ac4ac into main Nov 26, 2026
39 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 26, 2026 21:53 — with GitHub Actions Inactive
athvin added a commit that referenced this pull request Nov 27, 2026
… epic and #1279's duplicates Parquet export (#1300)

#1286 (248e296) was one commit, d245d4a. Its parent was a fresh main
(8b5b25a), but 75 files in its tree were the versions from dc45fd1:
a tree from an old worktree was committed on top of a new base. The
squash was CLEAN and the old code is self-consistent, so every gate
passed while it undid:

- the cinematic epic #1253: #1272, #1275, #1278, #1280, #1282, #1283
  and #1285, with their tests and visual baselines;
- #1279's Parquet export for duplicate groups (exports.rs, read.rs,
  export_write.rs and the ExportIn doc comment).

This is the merge #1286 should have produced, computed rather than
hand-picked:

1. Give d245d4a's tree its real parent, dc45fd1.
2. Three-way merge it into 2b8f0b8, the main it landed on, with base
   dc45fd1. No conflicts.
3. Carry the difference from 248e296 onto today's main with another
   three-way merge. No conflicts.

#1286's own work is kept: the usage endpoint, the record allowance, and
the docs on usage and the 402.

Closes #1299

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was previously deployed

1 inactive deployment
marketing-preview — 53a9b801 Deployed Nov 26, 2026 by athvin via remove closed PR previews #77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E11.3c — Parquet export for duplicate groups

2 participants