In this article
Retain both input sort definitions, stable identities and the reviewed group-constrained matches.
A feature builder sorts records by entity and then time, assuming this satisfies a grouped as-of join. The time key restarts between entities, so the input violates the join API sorting precondition.
The mechanism that changes the example
The as-of key must be ordered as required by merge_asof; by controls group matching rather than replacing that sorting obligation. A visually organized per-entity table is not necessarily a valid globally ordered input.
Define the comparison boundary
Retain a row identifier before sorting either table. After merge_asof, use that identifier to restore the consumer’s requested order; positional equality with a separately held label array is otherwise lost even when every temporal match is correct.
Check monotonicity of the actual as-of key across the entire input. Sorting each account’s history separately does not satisfy this condition when the next account starts earlier. The by columns restrict eligible matches inside the merge and need not be the primary sort columns.
Define a tie policy for duplicate right-side timestamps within a group. A successful sorted merge cannot establish which conflicting duplicate is authoritative. Test shuffled duplicates separately, reject ambiguous versions when required, and compare selected right-side identifiers rather than only the resulting numerical feature values.
A constructed test case
Create overlapping entity timelines whose group-first sort makes the time key decrease between groups. Compare that input with global time sorting plus by isolation, preserving original row identities for a matched-output audit.
A reproducible validation procedure
Construct interleaving entity timelines and compare group-first with global as-of-key ordering. Preserve stable row identity before sorting, use by for entity isolation and verify matched keys against a hand-specified reference relation.
Include an unchanged control and a deliberately invalid case. Verify that the checker distinguishes them before testing the complete release.
Exercise the actual preparation path, including later serialization and reload. Limit retained diagnostic content to the evidence required for this comparison.
Evidence needed for acceptance
Retain both input sort definitions, stable identities and the reviewed group-constrained matches.
Containment and recovery
Satisfying the sort precondition does not establish correct direction, tolerance or information availability.
Quarantine an invalid release candidate or use an explicit partial-release rule. Preserve the last approved artifact and record corrections without silently rewriting historical inputs.
Interpretation and references
Implementation references: pandas as-of joins; pandas ordered and as-of merge guide.
This is a proposed engineering validation, not an executed Retrivium benchmark. Documentation specifies interfaces; dataset acceptance needs its own evidence and must be repeated after relevant dependency changes.
Related reading
Continue with cuDF joins: define missing-key treatment and row multiplicity before enriching features; COCO: preserve image and annotation identities. These guides supply adjacent context; the decision in this article remains the specific example-preservation check above.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.