Styxis
Company
Knowledge

A tuple key becomes a list after Beam Reshuffle: check values and container semantics

Check tuple values separately from the hashable-container contract.

An obligation lost when only values remain

Check tuple values separately from the hashable-container contract. A list produced after the schema boundary must not enter a stage requiring a dictionary key. Extract Python object kind before flattening it into Truthound inputs; keeping only a and b would erase the hashability distinction. [1, 2, 3]

A schema boundary with unresolved alternatives

Beam #40079 reports typed Python tuples returning as lists after RowCoder serialization, breaking hash-key use, while heterogeneous tuples have a separate encode failure. A comment discusses tradeoffs in falling back to Any or introducing logical types within portable schemas. These are alternatives, not an adopted correction. [1]

A control varying the hints

Send identical values through typed and Any paths, recording container kind after serialization and blocking a list key that the contract does not permit. Vary hints and the serialization boundary while holding values constant. Extract kind while the Python object still exists, and reconcile element order and values separately. [1, 3]

The same a,b values in different containers

The illustrative key (a,b) requires an immutable tuple. Readback kind tuple meets that condition; a list with the same values fails the hashable-key contract. If the downstream stage requires only a sequence, enforcing tuple identity may be unnecessarily strict. [1, 3]

Compare extracted container kinds

Truthound Core Python SDK 3.3.2 can compare prepared required_key_container_kind and decoded_container_kind through ColumnPairValidator with relationship="==". It checks extracted kind strings rather than reconstructing Python object identity from a Polars table. Beam schema changes, coder repairs and an actual hash-key test remain separate work. [1, 2, 3]

Use distinct checks for the two failures

Consider explicit key serialization or a tuple logical type, and test the cross-SDK cost of an Any fallback. Treating a heterogeneous tuple as a homogeneous array requires its own element-type comparison. One container-kind check does not resolve both reported paths. [1, 3]

Application conditions

Extract container kind before converting Python objects into tabular inputs, and check element values separately.

Alternatives

Test explicit key serialization or logical types and assess the portability cost of an Any fallback.

Limitations

  • The SDK does not change Beam schemas or coders or recreate Python tuple identity from a table.

Evidence

Event checked
Subject checked
Modified