2010YOUY01 commented on code in PR #12309:
URL: https://github.com/apache/datafusion/pull/12309#discussion_r1750029406
##########
datafusion/functions/src/string/concat_ws.rs:
##########
@@ -155,21 +169,53 @@ impl ScalarUDFImpl for ConcatWsFunc {
let mut columns = Vec::with_capacity(args.len() - 1);
for arg in &args[1..] {
match arg {
- ColumnarValue::Scalar(ScalarValue::Utf8(maybe_value)) => {
+ ColumnarValue::Scalar(ScalarValue::Utf8(maybe_value))
+ | ColumnarValue::Scalar(ScalarValue::LargeUtf8(maybe_value))
+ | ColumnarValue::Scalar(ScalarValue::Utf8View(maybe_value)) =>
{
if let Some(s) = maybe_value {
data_size += s.len() * len;
columns.push(ColumnarValueRef::Scalar(s.as_bytes()));
}
}
ColumnarValue::Array(array) => {
- let string_array = as_string_array(array)?;
- data_size += string_array.values().len();
- let column = if array.is_nullable() {
- ColumnarValueRef::NullableArray(string_array)
- } else {
- ColumnarValueRef::NonNullableArray(string_array)
+ match array.data_type() {
+ DataType::Utf8 => {
+ let string_array = as_string_array(array)?;
+
+ data_size += string_array.values().len();
+ let column = if array.is_nullable() {
+ ColumnarValueRef::NullableArray(string_array)
+ } else {
+
ColumnarValueRef::NonNullableArray(string_array)
+ };
+ columns.push(column);
+ },
+ DataType::LargeUtf8 => {
+ let string_array = as_largestring_array(array);
+
+ data_size += string_array.values().len();
+ let column = if array.is_nullable() {
+
ColumnarValueRef::NullableLargeStringArray(string_array)
+ } else {
+
ColumnarValueRef::NonNullableLargeStringArray(string_array)
+ };
+ columns.push(column);
+ },
+ DataType::Utf8View => {
+ let string_array = as_string_view_array(array)?;
+
+ data_size += string_array.len();
Review Comment:
`data_size` is the estimated string array size after concatenation, I think
here it should increment sum of inner buffers' size instead
(And everything else LGTM)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]