Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 1 addition & 53 deletions datafusion/expr/src/udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use arrow::datatypes::{DataType, Field, FieldRef};
#[cfg(debug_assertions)]
use datafusion_common::assert_or_internal_err;
use datafusion_common::config::ConfigOptions;
use datafusion_common::{ExprSchema, Result, ScalarValue, not_impl_err};
use datafusion_common::{Result, ScalarValue, not_impl_err};
use datafusion_expr_common::dyn_eq::{DynEq, DynHash};
use datafusion_expr_common::interval_arithmetic::Interval;
use datafusion_expr_common::placement::ExpressionPlacement;
Expand Down Expand Up @@ -183,18 +183,6 @@ impl ScalarUDF {
self.inner.name()
}

/// Returns this function's display_name.
///
/// See [`ScalarUDFImpl::display_name`] for more details
#[deprecated(
since = "50.0.0",
note = "This method is unused and will be removed in a future release"
)]
pub fn display_name(&self, args: &[Expr]) -> Result<String> {
#[expect(deprecated)]
self.inner.display_name(args)
}

/// Returns this function's schema_name.
///
/// See [`ScalarUDFImpl::schema_name`] for more details
Expand Down Expand Up @@ -255,12 +243,6 @@ impl ScalarUDF {
self.inner.simplify(args, info)
}

#[deprecated(since = "50.0.0", note = "Use `return_field_from_args` instead.")]
pub fn is_nullable(&self, args: &[Expr], schema: &dyn ExprSchema) -> bool {
#[expect(deprecated)]
self.inner.is_nullable(args, schema)
}

/// Return a preimage
///
/// See [`ScalarUDFImpl::preimage`] for more details.
Expand Down Expand Up @@ -551,22 +533,6 @@ pub trait ScalarUDFImpl: Debug + DynEq + DynHash + Send + Sync + Any {
&[]
}

/// Returns the user-defined display name of function, given the arguments
///
/// This can be used to customize the output column name generated by this
/// function.
///
/// Defaults to `name(args[0], args[1], ...)`
#[deprecated(
since = "50.0.0",
note = "This method is unused and will be removed in a future release"
)]
fn display_name(&self, args: &[Expr]) -> Result<String> {
let names: Vec<String> = args.iter().map(ToString::to_string).collect();
// TODO: join with ", " to standardize the formatting of Vec<Expr>, <https://github.com/apache/datafusion/issues/10364>
Ok(format!("{}({})", self.name(), names.join(",")))
}

/// Returns the name of the column this expression would create
///
/// See [`Expr::schema_name`] for details
Expand Down Expand Up @@ -698,14 +664,6 @@ pub trait ScalarUDFImpl: Debug + DynEq + DynHash + Send + Sync + Any {
Ok(Arc::new(Field::new(self.name(), return_type, true)))
}

#[deprecated(
since = "45.0.0",
note = "Use `return_field_from_args` instead. if you use `is_nullable` that returns non-nullable with `return_type`, you would need to switch to `return_field_from_args`, you might have error"
)]
fn is_nullable(&self, _args: &[Expr], _schema: &dyn ExprSchema) -> bool {
true
}

/// Returns true if this function always returns NULL when any argument is
/// NULL.
///
Expand Down Expand Up @@ -1112,11 +1070,6 @@ impl ScalarUDFImpl for AliasedScalarUDFImpl {
self.inner.name()
}

fn display_name(&self, args: &[Expr]) -> Result<String> {
#[expect(deprecated)]
self.inner.display_name(args)
}

fn schema_name(&self, args: &[Expr]) -> Result<String> {
self.inner.schema_name(args)
}
Expand All @@ -1133,11 +1086,6 @@ impl ScalarUDFImpl for AliasedScalarUDFImpl {
self.inner.return_field_from_args(args)
}

fn is_nullable(&self, args: &[Expr], schema: &dyn ExprSchema) -> bool {
#[expect(deprecated)]
self.inner.is_nullable(args, schema)
}

fn is_strict(&self) -> bool {
self.inner.is_strict()
}
Expand Down
18 changes: 0 additions & 18 deletions datafusion/functions-nested/src/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,6 @@ impl ScalarUDFImpl for ArrayElement {
"array_element"
}

fn display_name(&self, args: &[Expr]) -> Result<String> {
let args_name = args.iter().map(ToString::to_string).collect::<Vec<_>>();
if args_name.len() != 2 {
return exec_err!("expect 2 args, got {}", args_name.len());
}

Ok(format!("{}[{}]", args_name[0], args_name[1]))
}

fn schema_name(&self, args: &[Expr]) -> Result<String> {
let args_name = args
.iter()
Expand Down Expand Up @@ -351,15 +342,6 @@ impl ArraySlice {
}

impl ScalarUDFImpl for ArraySlice {
fn display_name(&self, args: &[Expr]) -> Result<String> {
let args_name = args.iter().map(ToString::to_string).collect::<Vec<_>>();
if let Some((arr, indexes)) = args_name.split_first() {
Ok(format!("{arr}[{}]", indexes.join(":")))
} else {
exec_err!("no argument")
}
}

fn schema_name(&self, args: &[Expr]) -> Result<String> {
let args_name = args
.iter()
Expand Down
20 changes: 0 additions & 20 deletions datafusion/functions/src/core/getfield.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,26 +380,6 @@ impl ScalarUDFImpl for GetFieldFunc {
"get_field"
}

fn display_name(&self, args: &[Expr]) -> Result<String> {
if args.len() < 2 {
return exec_err!(
"get_field requires at least 2 arguments, got {}",
args.len()
);
}

let base = &args[0];
let field_names: Vec<String> = args[1..]
.iter()
.map(|f| match f {
Expr::Literal(name, _) => name.to_string(),
other => other.schema_name().to_string(),
})
.collect();

Ok(format!("{}[{}]", base, field_names.join("][")))
}

fn schema_name(&self, args: &[Expr]) -> Result<String> {
if args.len() < 2 {
return exec_err!(
Expand Down