This is an automated email from the ASF dual-hosted git repository. xudong963 pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push: new 5c370fa620 Simplify `GetFieldFunc`'s display_name`, `schema_name` (#17167) 5c370fa620 is described below commit 5c370fa620eb05d07ad9ef70b5a8a959c46cefe6 Author: Piotr Findeisen <piotr.findei...@gmail.com> AuthorDate: Thu Aug 14 13:02:39 2025 +0200 Simplify `GetFieldFunc`'s display_name`, `schema_name` (#17167) There is no need to create intermediate `ScalarValue::Utf8` if all we want is the inner value. --- datafusion/functions/src/core/getfield.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/datafusion/functions/src/core/getfield.rs b/datafusion/functions/src/core/getfield.rs index 98b8189169..81dd3c7797 100644 --- a/datafusion/functions/src/core/getfield.rs +++ b/datafusion/functions/src/core/getfield.rs @@ -108,8 +108,8 @@ impl ScalarUDFImpl for GetFieldFunc { let [base, field_name] = take_function_args(self.name(), args)?; let name = match field_name { - Expr::Literal(name, _) => name, - other => &ScalarValue::Utf8(Some(other.schema_name().to_string())), + Expr::Literal(name, _) => name.to_string(), + other => other.schema_name().to_string(), }; Ok(format!("{base}[{name}]")) @@ -118,8 +118,8 @@ impl ScalarUDFImpl for GetFieldFunc { fn schema_name(&self, args: &[Expr]) -> Result<String> { let [base, field_name] = take_function_args(self.name(), args)?; let name = match field_name { - Expr::Literal(name, _) => name, - other => &ScalarValue::Utf8(Some(other.schema_name().to_string())), + Expr::Literal(name, _) => name.to_string(), + other => other.schema_name().to_string(), }; Ok(format!("{}[{}]", base.schema_name(), name)) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@datafusion.apache.org For additional commands, e-mail: commits-h...@datafusion.apache.org