Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
erenavsarogullari committed Feb 6, 2025
1 parent 0dbdbba commit 222bf3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
25 changes: 2 additions & 23 deletions datafusion/functions-nested/src/max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use arrow_schema::DataType::{FixedSizeList, LargeList, List};
use datafusion_common::cast::as_list_array;
use datafusion_common::exec_err;
use datafusion_doc::Documentation;
use datafusion_expr::{ColumnarValue, Expr, ScalarUDFImpl, Signature, Volatility};
use datafusion_expr::{ColumnarValue, ScalarUDFImpl, Signature, Volatility};
use datafusion_macros::user_doc;
use std::any::Any;
use std::sync::Arc;
Expand Down Expand Up @@ -84,27 +84,6 @@ impl ScalarUDFImpl for ArrayMax {
"array_max"
}

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

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

fn schema_name(&self, args: &[Expr]) -> datafusion_common::Result<String> {
let args_name = args
.iter()
.map(|e| e.schema_name().to_string())
.collect::<Vec<_>>();
if args_name.len() != 1 {
return exec_err!("expects 1 arg, got {}", args_name.len());
}

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

fn signature(&self) -> &Signature {
&self.signature
}
Expand Down Expand Up @@ -152,7 +131,7 @@ pub fn array_max_inner(args: &[ArrayRef]) -> datafusion_common::Result<ArrayRef>
match &args[0].data_type() {
List(_) | LargeList(_) | FixedSizeList(_, _) => {
let new_args = vec![
args[0].clone(),
Arc::<dyn Array>::clone(&args[0]),
Arc::new(StringArray::from_iter(vec![Some("DESC")])),
Arc::new(StringArray::from_iter(vec![Some("NULLS LAST")])),
];
Expand Down
4 changes: 4 additions & 0 deletions docs/source/user-guide/sql/scalar_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -3788,6 +3788,10 @@ _Alias of [array_to_string](#array_to_string)._

_Alias of [array_length](#array_length)._

### `list_max`

_Alias of [array_max](#array_max)._

### `list_ndims`

_Alias of [array_ndims](#array_ndims)._
Expand Down

0 comments on commit 222bf3b

Please sign in to comment.