Styxis
Company
Knowledge

Polars zero-column round trips: preserve height 3 as independent state

An empty column array does not imply zero rows. Check explicit height across an extension interface.

A table without columns can still have height

Row count is independent table state, not always recoverable from column arrays. A computation can retain meaningful row existence even when its column selection is empty. Treating no columns as no input breaks subsequent length contracts. [1, 2, 3]

Height lost by an identity conversion

Polars issue 30495 reports a PyDataFrame identity round trip changing shape (3,0) to (0,0). It describes both conversion directions reconstructing the table from columns without preserving explicit height. Ordinary round-trip tests with populated columns can miss this boundary. [1]

Record height before conversion

Export explicit before and after heights to a separate audit table, including empty-column selections. Bind them by extension-call identity so both measurements refer to the same input. Do not infer and fill the original height after only the output remains. [1, 3]

Distinguish 0 columns from 0 rows

Define illustrative input with 3 rows and 0 columns. Expected identity-round-trip height is 3. Output height 3 preserves the original row count even without columns. A height of 0 means the identity round trip lost that row state. Equal column count 0 cannot detect the difference. An input originally having height 0 has another expectation, so empty columns alone do not justify requiring 3. [1, 3]

Give Truthound an audit table containing heights

Truthound Core's ColumnPairValidator can compare height_before with height_after. Its input is the separate table containing measured heights, not the original zero-column frame. The validator cannot restore height already lost. Explicitly transmit height metadata through the extension interface, then retest both empty-column and ordinary-column controls. [1, 2, 3]

Application conditions

Extract height_before, height_after and column_count around the same conversion_id, preserving the original height independently.

Alternatives

Pass height metadata separately through the extension interface.

Limitations

  • Giving Truthound only a zero-column table whose height is already lost cannot recover the original height.

Evidence

Event checked
Subject checked
Modified