Skip to content

Commit d66a2d3

Browse files
committed
Document CastColumnExpr behavior and usage constraints
Expand the rustdoc for CastColumnExpr::new to detail its single-field schema behavior and usage constraints. Clarify when to use new_with_schema for scenarios with broader schema dependencies.
1 parent e334a22 commit d66a2d3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

datafusion/physical-expr/src/expressions/cast_column.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ impl CastColumnExpr {
148148
///
149149
/// This constructor ensures that format options are populated with defaults,
150150
/// normalizing the CastOptions for consistent behavior during serialization
151-
/// and evaluation.
151+
/// and evaluation. It constructs a single-field schema from `input_field`,
152+
/// so it should only be used for expressions that resolve their type from
153+
/// that field alone.
152154
pub fn new(
153155
expr: Arc<dyn PhysicalExpr>,
154156
input_field: FieldRef,
@@ -167,8 +169,8 @@ impl CastColumnExpr {
167169

168170
/// Create a new [`CastColumnExpr`] with a specific input schema.
169171
///
170-
/// This constructor is useful when the expression depends on multiple
171-
/// fields from a broader schema.
172+
/// Use this constructor when the expression depends on a broader schema,
173+
/// such as multi-column expressions or columns with non-zero indexes.
172174
pub fn new_with_schema(
173175
expr: Arc<dyn PhysicalExpr>,
174176
input_field: FieldRef,

0 commit comments

Comments
 (0)