Context sampling indexed source batches by the primary key's position
in the ingest config. Parquet batches keep the file's column order, so
when the orders differ the sample measured another column. For a long
string key, that can choose gxhash for the PK map, where twin keys fail
the MPHF build. kumo-pytorch sorts config columns by name, so its
configs rarely match the file's order.
Resolve the key by name at both sampling sites through a source_column
helper, which build_access_cols and the edge-table loop also use.
Also move sample_context_batches's doc comment off max_binary_value_len.
What
Context sampling records each node table's longest primary key. For string and bytes keys, that length picks the PK map's hash: gxhash up to 16 bytes, xxh3 above. The sample read the key from source batches by its position in the ingest config, but Parquet batches keep the file's column order, so a config ordered differently from the file measured another column. Each index stores its hash choice, so existing indexes still load and resolve.
source_columnhelper.build_access_colsand the edge-table column loop, which already resolved by name. Its missing-column error names the column.test_long_string_pk_sampled_by_name, which reproduces the failure below.sample_context_batches's doc comment, which sat onmax_binary_value_len.Why
xxh3 is the fallback for keys gxhash can't separate: above 16 bytes, gxhash collisions are constructible and hold under every seed. A table lost that fallback whenever its file had a shorter or non-string column at the primary key's config position. If two of its keys then collided under gxhash, ingest failed in the PK-map phase with
ptrhash construction failed, after encode had finished. Every retry failed the same way.kumo-pytorch hits the mismatch by default, because
_compile_diskgraph_configlists each table's columns sorted by name, whatever the file's order. For example, a Parquet table written aslabel, idwith primary keyidcompiles to a config listingid, label, so sampling measuredlabel. With the two strings fromptr_hash::hash::gxhash_twins()as itsidvalues, the ingest fails. The new test is this repro.No setting forces the fallback hash. The only workaround was to rewrite the source files so the primary key sits at its config position. For kumo-pytorch, that means writing each table's declared columns in name order.
Change map
File-by-file change map.