Bug
When an INSERT source column has the same Arrow storage DataType as the target column but the target has Arrow extension metadata, SQL planning skips the cast because it compares only DataType. The resulting DML projection therefore has the source field metadata instead of the target table field metadata.
For example, inserting an unannotated FixedSizeBinary(16) column into an arrow.uuid column produces a projection without the UUID extension marker. This can also affect other extension types represented by field metadata.
Expected behavior
The DML projection should enforce the target column metadata, including Arrow extension metadata, even when source and target storage types are identical.
Additional context
Cast and CastExpr already support full target Field semantics. The INSERT planner currently calls cast_to(target_field.data_type(), ...), which only enforces the storage type.
Bug
When an
INSERTsource column has the same Arrow storageDataTypeas the target column but the target has Arrow extension metadata, SQL planning skips the cast because it compares onlyDataType. The resulting DML projection therefore has the source field metadata instead of the target table field metadata.For example, inserting an unannotated
FixedSizeBinary(16)column into anarrow.uuidcolumn produces a projection without the UUID extension marker. This can also affect other extension types represented by field metadata.Expected behavior
The DML projection should enforce the target column metadata, including Arrow extension metadata, even when source and target storage types are identical.
Additional context
CastandCastExpralready support full targetFieldsemantics. The INSERT planner currently callscast_to(target_field.data_type(), ...), which only enforces the storage type.