Skip to content
Merged
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
3 changes: 1 addition & 2 deletions datafusion/functions-nested/src/cardinality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ impl ScalarUDFImpl for Cardinality {
}
}

/// Cardinality SQL function
pub fn cardinality_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn cardinality_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array] = take_function_args("cardinality", args)?;
match array.data_type() {
Null => Ok(Arc::new(UInt64Array::from_value(0, array.len()))),
Expand Down
9 changes: 3 additions & 6 deletions datafusion/functions-nested/src/concat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,7 @@ impl ScalarUDFImpl for ArrayConcat {
}
}

/// Array_concat/Array_cat SQL function
pub(crate) fn array_concat_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_concat_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
if args.is_empty() {
return exec_err!("array_concat expects at least one argument");
}
Expand Down Expand Up @@ -453,8 +452,7 @@ fn concat_internal<O: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> {

// Kernel functions

/// Array_append SQL function
pub(crate) fn array_append_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_append_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array, values] = take_function_args("array_append", args)?;
match array.data_type() {
DataType::Null => make_array_inner(&[Arc::clone(values)]),
Expand All @@ -464,8 +462,7 @@ pub(crate) fn array_append_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
}
}

/// Array_prepend SQL function
pub(crate) fn array_prepend_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_prepend_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [values, array] = take_function_args("array_prepend", args)?;
match array.data_type() {
DataType::Null => make_array_inner(&[Arc::clone(values)]),
Expand Down
6 changes: 2 additions & 4 deletions datafusion/functions-nested/src/dimension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ impl ScalarUDFImpl for ArrayNdims {
}
}

/// Array_dims SQL function
pub fn array_dims_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_dims_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array] = take_function_args("array_dims", args)?;
let data: Vec<_> = match array.data_type() {
List(_) => as_list_array(&array)?
Expand All @@ -214,8 +213,7 @@ pub fn array_dims_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
Ok(Arc::new(result))
}

/// Array_ndims SQL function
pub fn array_ndims_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_ndims_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array] = take_function_args("array_ndims", args)?;

fn general_list_ndims(array: &ArrayRef) -> Result<ArrayRef> {
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions-nested/src/distance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl ScalarUDFImpl for ArrayDistance {
}
}

pub fn array_distance_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_distance_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array1, array2] = take_function_args("array_distance", args)?;
match (array1.data_type(), array2.data_type()) {
(List(_), List(_)) => general_array_distance::<i32>(args),
Expand Down
3 changes: 1 addition & 2 deletions datafusion/functions-nested/src/empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ impl ScalarUDFImpl for ArrayEmpty {
}
}

/// Array_empty SQL function
pub fn array_empty_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_empty_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array] = take_function_args("array_empty", args)?;
match array.data_type() {
List(_) => general_array_empty::<i32>(array),
Expand Down
3 changes: 1 addition & 2 deletions datafusion/functions-nested/src/except.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ impl ScalarUDFImpl for ArrayExcept {
}
}

/// Array_except SQL function
pub fn array_except_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_except_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array1, array2] = take_function_args("array_except", args)?;

match (array1.data_type(), array2.data_type()) {
Expand Down
3 changes: 1 addition & 2 deletions datafusion/functions-nested/src/flatten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ impl ScalarUDFImpl for Flatten {
}
}

/// Flatten SQL function
pub fn flatten_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn flatten_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array] = take_function_args("flatten", args)?;

match array.data_type() {
Expand Down
3 changes: 1 addition & 2 deletions datafusion/functions-nested/src/length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ macro_rules! array_length_impl {
}};
}

/// Array_length SQL function
pub fn array_length_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_length_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
if args.len() != 1 && args.len() != 2 {
return exec_err!("array_length expects one or two arguments");
}
Expand Down
11 changes: 2 additions & 9 deletions datafusion/functions-nested/src/min_max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,7 @@ impl ScalarUDFImpl for ArrayMax {
}
}

/// array_max SQL function
///
/// There is one argument for array_max as the array.
/// `array_max(array)`
///
/// For example:
/// > array_max(\[1, 3, 2]) -> 3
pub fn array_max_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_max_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array] = take_function_args("array_max", args)?;
match array.data_type() {
List(_) => array_min_max_helper(as_list_array(array)?, max_batch),
Expand Down Expand Up @@ -202,7 +195,7 @@ impl ScalarUDFImpl for ArrayMin {
}
}

pub fn array_min_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_min_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array] = take_function_args("array_min", args)?;
match array.data_type() {
List(_) => array_min_max_helper(as_list_array(array)?, min_batch),
Expand Down
7 changes: 3 additions & 4 deletions datafusion/functions-nested/src/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ impl ScalarUDFImpl for ArrayPosition {
}
}

/// Array_position SQL function
pub fn array_position_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_position_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
if args.len() < 2 || args.len() > 3 {
return exec_err!("array_position expects two or three arguments");
}
Expand All @@ -152,6 +151,7 @@ pub fn array_position_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
array_type => exec_err!("array_position does not support type '{array_type}'."),
}
}

fn general_position_dispatch<O: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> {
let list_array = as_generic_list_array::<O>(&args[0])?;
let element_array = &args[1];
Expand Down Expand Up @@ -292,8 +292,7 @@ impl ScalarUDFImpl for ArrayPositions {
}
}

/// Array_positions SQL function
pub fn array_positions_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_positions_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array, element] = take_function_args("array_positions", args)?;

match &array.data_type() {
Expand Down
9 changes: 3 additions & 6 deletions datafusion/functions-nested/src/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,24 +284,21 @@ impl ScalarUDFImpl for ArrayRemoveAll {
}
}

/// Array_remove SQL function
pub fn array_remove_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_remove_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array, element] = take_function_args("array_remove", args)?;

let arr_n = vec![1; array.len()];
array_remove_internal(array, element, &arr_n)
}

/// Array_remove_n SQL function
pub fn array_remove_n_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_remove_n_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array, element, max] = take_function_args("array_remove_n", args)?;

let arr_n = as_int64_array(max)?.values().to_vec();
array_remove_internal(array, element, &arr_n)
}

/// Array_remove_all SQL function
pub fn array_remove_all_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_remove_all_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array, element] = take_function_args("array_remove_all", args)?;

let arr_n = vec![i64::MAX; array.len()];
Expand Down
3 changes: 1 addition & 2 deletions datafusion/functions-nested/src/repeat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ impl ScalarUDFImpl for ArrayRepeat {
}
}

/// Array_repeat SQL function
pub fn array_repeat_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_repeat_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let element = &args[0];
let count_array = &args[1];

Expand Down
6 changes: 3 additions & 3 deletions datafusion/functions-nested/src/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ fn general_replace<O: OffsetSizeTrait>(
)?))
}

pub(crate) fn array_replace_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_replace_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array, from, to] = take_function_args("array_replace", args)?;

// replace at most one occurrence for each element
Expand All @@ -437,7 +437,7 @@ pub(crate) fn array_replace_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
}
}

pub(crate) fn array_replace_n_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_replace_n_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array, from, to, max] = take_function_args("array_replace_n", args)?;

// replace the specified number of occurrences
Expand All @@ -458,7 +458,7 @@ pub(crate) fn array_replace_n_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
}
}

pub(crate) fn array_replace_all_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_replace_all_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array, from, to] = take_function_args("array_replace_all", args)?;

// replace all occurrences (up to "i64::MAX")
Expand Down
3 changes: 1 addition & 2 deletions datafusion/functions-nested/src/resize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ impl ScalarUDFImpl for ArrayResize {
}
}

/// array_resize SQL function
pub(crate) fn array_resize_inner(arg: &[ArrayRef]) -> Result<ArrayRef> {
fn array_resize_inner(arg: &[ArrayRef]) -> Result<ArrayRef> {
if arg.len() < 2 || arg.len() > 3 {
return exec_err!("array_resize needs two or three arguments");
}
Expand Down
2 changes: 0 additions & 2 deletions datafusion/functions-nested/src/set_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,13 +501,11 @@ fn general_set_op(
}
}

/// Array_union SQL function
fn array_union_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array1, array2] = take_function_args("array_union", args)?;
general_set_op(array1, array2, SetOp::Union)
}

/// array_intersect SQL function
fn array_intersect_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
let [array1, array2] = take_function_args("array_intersect", args)?;
general_set_op(array1, array2, SetOp::Intersect)
Expand Down
6 changes: 2 additions & 4 deletions datafusion/functions-nested/src/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ impl ScalarUDFImpl for ArraySort {
}
}

/// Array_sort SQL function
pub fn array_sort_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_sort_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
if args.is_empty() || args.len() > 3 {
return exec_err!("array_sort expects one to three arguments");
}
Expand Down Expand Up @@ -218,8 +217,7 @@ pub fn array_sort_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
}
}

/// Array_sort SQL function
pub fn array_sort_generic<OffsetSize: OffsetSizeTrait>(
fn array_sort_generic<OffsetSize: OffsetSizeTrait>(
list_array: &GenericListArray<OffsetSize>,
field: &FieldRef,
sort_options: Option<SortOptions>,
Expand Down
3 changes: 1 addition & 2 deletions datafusion/functions-nested/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,7 @@ impl ScalarUDFImpl for StringToArray {
}
}

/// Array_to_string SQL function
pub(super) fn array_to_string_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
fn array_to_string_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
if args.len() < 2 || args.len() > 3 {
return exec_err!("array_to_string expects two or three arguments");
}
Expand Down
4 changes: 2 additions & 2 deletions datafusion/functions/src/core/overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ fn overlay<T: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> {
}
}

pub fn string_overlay<T: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> {
fn string_overlay<T: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> {
match args.len() {
3 => {
let string_array = as_generic_string_array::<T>(&args[0])?;
Expand All @@ -227,7 +227,7 @@ pub fn string_overlay<T: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef>
}
}

pub fn string_view_overlay<T: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> {
fn string_view_overlay<T: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> {
match args.len() {
3 => {
let string_array = as_string_view_array(&args[0])?;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions/src/core/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Default for VersionFunc {
impl VersionFunc {
pub fn new() -> Self {
Self {
signature: Signature::exact(vec![], Volatility::Immutable),
signature: Signature::nullary(Volatility::Immutable),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions/src/math/iszero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl ScalarUDFImpl for IsZeroFunc {
}

/// Iszero SQL function
pub fn iszero(args: &[ArrayRef]) -> Result<ArrayRef> {
fn iszero(args: &[ArrayRef]) -> Result<ArrayRef> {
match args[0].data_type() {
Float64 => Ok(Arc::new(BooleanArray::from_unary(
args[0].as_primitive::<Float64Type>(),
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions/src/math/round.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl ScalarUDFImpl for RoundFunc {
}

/// Round SQL function
pub fn round(args: &[ArrayRef]) -> Result<ArrayRef> {
fn round(args: &[ArrayRef]) -> Result<ArrayRef> {
if args.len() != 1 && args.len() != 2 {
return exec_err!(
"round function requires one or two arguments, got {}",
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions/src/math/signum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl ScalarUDFImpl for SignumFunc {
}

/// signum SQL function
pub fn signum(args: &[ArrayRef]) -> Result<ArrayRef> {
fn signum(args: &[ArrayRef]) -> Result<ArrayRef> {
match args[0].data_type() {
Float64 => Ok(Arc::new(
args[0]
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions/src/regex/regexpcount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ pub fn regexp_count_func(args: &[ArrayRef]) -> Result<ArrayRef> {
///
/// # Errors
/// Returns an error if the input arrays have mismatched lengths or if the regular expression fails to compile.
pub fn regexp_count(
fn regexp_count(
values: &dyn Array,
regex_array: &dyn Datum,
start_array: Option<&dyn Datum>,
Expand Down
Loading