Integrate cast_column into PhysicalExprAdapter
source: #17281 (comment)
Implementation Plan: CastColumnExpr
-
Introduce CastColumnExpr itself. Add the new expression type, its evaluation semantics for arrays and scalars, nullable/return-field fixes, and dedicated unit tests in the physical expression crate, together with the public re-export.
-
Teach the physical-expression utilities about CastColumnExpr. Extend equivalence tracking, interval reasoning, and cast-unwrapping simplifications (plus their tests) so the optimizer understands the new node before any other subsystem depends on it.
-
Add serialization / deserialization support. Wire CastColumnExpr through the protobuf schema, the to/from proto converters, and the round-trip tests so distributed execution can safely move plans containing it.
-
Update pruning to handle CastColumnExpr. Once the new node is available everywhere, extend rewrite_expr_to_prunable and its regression tests so statistics-based pruning continues to work with casted columns.
-
Refactor the schema rewriter in preparation. Land the structural cleanup and new helper routines (like the quick struct compatibility check) independently so reviewers can verify the reshaping without functional changes mixed in.
-
Finally, switch the adapter to CastColumnExpr and add behavior tests. Make the actual rewrite produce CastColumnExpr, rely on the struct-aware casting path, and add the new error / round-trip tests that prove the behavior with missing fields and nullable handling.
Integrate cast_column into PhysicalExprAdapter
source: #17281 (comment)
Implementation Plan: CastColumnExpr
Introduce
CastColumnExpritself. Add the new expression type, its evaluation semantics for arrays and scalars, nullable/return-field fixes, and dedicated unit tests in the physical expression crate, together with the public re-export.Teach the physical-expression utilities about
CastColumnExpr. Extend equivalence tracking, interval reasoning, and cast-unwrapping simplifications (plus their tests) so the optimizer understands the new node before any other subsystem depends on it.Add serialization / deserialization support. Wire
CastColumnExprthrough the protobuf schema, the to/from proto converters, and the round-trip tests so distributed execution can safely move plans containing it.Update pruning to handle
CastColumnExpr. Once the new node is available everywhere, extendrewrite_expr_to_prunableand its regression tests so statistics-based pruning continues to work with casted columns.Refactor the schema rewriter in preparation. Land the structural cleanup and new helper routines (like the quick struct compatibility check) independently so reviewers can verify the reshaping without functional changes mixed in.
Finally, switch the adapter to
CastColumnExprand add behavior tests. Make the actual rewrite produceCastColumnExpr, rely on the struct-aware casting path, and add the new error / round-trip tests that prove the behavior with missing fields and nullable handling.