Expand description
Policy for rejecting VARIANT as a key.
Variant equality, hashing and ordering are byte-wise over the canonical encoding and carry no
stable SQL semantics, so a variant value must never become a key. DataType::contains_variant
is the only predicate; the checks are layered by how much they can be trusted.
Required to be complete, because they inspect the final key definition rather than a plan shape:
StreamMaterialize (a table’s, index’s or MV’s own pk) and
reject_variant_in_internal_storage_key (every streaming state table pk).
Last line of defense for batch, which has no state tables: reject_variant_keys. It runs after
logical optimization so rewrites are already resolved, but it is still shape-based — a new batch
operator that keys on a column needs an arm there.
Best-effort: StreamKeyChecker, which names the offending SQL clause early. Whatever it misses
is still caught above, only with a less specific message.
Constants§
- VARIANT_
KEY_ HINT - Shared hint for every
VARIANT-as-key rejection, so a test can assert one stable string regardless of which layer fired.
Functions§
- variant_
key_ error - Builds the rejection error so that every layer reports the same shape.