JoshElkind opened a new pull request, #20281: URL: https://github.com/apache/datafusion/pull/20281
## Which issue does this PR close? - Closes #15847. ## Rationale for this change As a follow-on to #15646 (Extension Type / Metadata support for Scalar UDFs), the narrow helpers on ExprSchema and ExprSchemable can be deprecated in favor of the single “get the field” API. Callers should use field_from_column / to_field and then read type, nullability, and metadata from the returned field, giving one consistent way to resolve expression/column schema info and allowing the deprecated methods to be removed in a later release. ## What changes are included in this PR? ExprSchema (datafusion_common): Deprecate nullable(col), data_type(col), metadata(col), and data_type_and_nullable(col) with #[deprecated(since = "53.0.0", note = "use field_from_column")]. Default implementations delegate to field_from_column(col). ExprSchemable (datafusion_expr): Deprecate get_type(schema), nullable(schema), and metadata(schema) with #[deprecated(since = "53.0.0", note = "use to_field")]; data_type_and_nullable was already deprecated (since 51.0.0). Default implementations delegate to to_field(schema). All internal uses of these methods are updated to to_field / field_from_column across expr, optimizer, sql, spark, substrait, examples, and docs. Test fixes (no production logic changed): test_inlist_nullability “long list” case now uses 7 elements so it hits the list.len() > 6 path; test_like_nullability expects nullable for Like/SimilarTo (current implementation always returns nullable); rewrite_sort_cols_by_agg_alias expected values use Column::new_unqualif ied so they match the rewriter’s unqualified output column names. Clippy: addressed collapsible_if and added #[expect(deprecated)] for the Expr::Wildcard match arm in expr_schema.rs. ## Are these changes tested? Yes. Existing tests cover the behavior; no new tests were added. The three test updates only align expectations with current implementation. cargo test -p datafusion-expr --lib and the broader test suite pass. Deprecated methods keep default implementations so behavior is unchanged for any remaining external callers until they migrate. ## Are there any user-facing changes? Yes. ExprSchema methods data_type, nullable, metadata, data_type_and_nullable are deprecated in favor of field_from_column(col) then the field’s accessors. ExprSchemable methods get_type, nullable, metadata, data_type_and_nullable are deprecated in favor of to_field(schema) then the field’s .data_type(), .is_nullable(), .metadata(). This is deprecation only; no APIs are removed and behavior is unchanged. The user guide (working-with-exprs.md) already documents using to_field for expression type/nullability. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
