Skip to content

Commit

Permalink
chore: rename function
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonLi-cn committed Apr 8, 2024
1 parent d0a1b4f commit fd04d4a
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions datafusion/functions/src/string/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,13 @@ where
{
match &args[0] {
ColumnarValue::Array(array) => match array.data_type() {
DataType::Utf8 => {
Ok(ColumnarValue::Array(convert_array::<i32, _>(array, op)?))
}
DataType::LargeUtf8 => {
Ok(ColumnarValue::Array(convert_array::<i64, _>(array, op)?))
}
DataType::Utf8 => Ok(ColumnarValue::Array(case_conversion_array::<i32, _>(
array, op,
)?)),
DataType::LargeUtf8 => Ok(ColumnarValue::Array(case_conversion_array::<
i64,
_,
>(array, op)?)),
other => exec_err!("Unsupported data type {other:?} for function {name}"),
},
ColumnarValue::Scalar(scalar) => match scalar {
Expand All @@ -141,7 +142,7 @@ where
}
}

fn convert_array<'a, O, F>(array: &'a ArrayRef, op: F) -> Result<ArrayRef>
fn case_conversion_array<'a, O, F>(array: &'a ArrayRef, op: F) -> Result<ArrayRef>
where
O: OffsetSizeTrait,
F: Fn(&'a str) -> String,
Expand Down Expand Up @@ -173,7 +174,7 @@ where

// Case2: full optimization
if the_first_nonascii_index == item_len {
return convert_ascii_array::<O, _>(array, op);
return case_conversion_ascii_array::<O, _>(array, op);
}

// Case3: partial optimization
Expand Down Expand Up @@ -216,7 +217,7 @@ where
}))
}

fn convert_ascii_array<'a, O, F>(array: &'a ArrayRef, op: F) -> Result<ArrayRef>
fn case_conversion_ascii_array<'a, O, F>(array: &'a ArrayRef, op: F) -> Result<ArrayRef>
where
O: OffsetSizeTrait,
F: Fn(&'a str) -> String,
Expand Down

0 comments on commit fd04d4a

Please sign in to comment.