jayzhan211 commented on code in PR #7629:
URL: https://github.com/apache/arrow-datafusion/pull/7629#discussion_r1354861676


##########
datafusion/common/src/scalar.rs:
##########
@@ -1872,35 +1940,12 @@ impl ScalarValue {
             ScalarValue::Fixedsizelist(..) => {
                 unimplemented!("FixedSizeList is not supported yet")
             }
-            ScalarValue::List(values, field) => Arc::new(match 
field.data_type() {
-                DataType::Boolean => build_list!(BooleanBuilder, Boolean, 
values, size),
-                DataType::Int8 => build_list!(Int8Builder, Int8, values, size),
-                DataType::Int16 => build_list!(Int16Builder, Int16, values, 
size),
-                DataType::Int32 => build_list!(Int32Builder, Int32, values, 
size),
-                DataType::Int64 => build_list!(Int64Builder, Int64, values, 
size),
-                DataType::UInt8 => build_list!(UInt8Builder, UInt8, values, 
size),
-                DataType::UInt16 => build_list!(UInt16Builder, UInt16, values, 
size),
-                DataType::UInt32 => build_list!(UInt32Builder, UInt32, values, 
size),
-                DataType::UInt64 => build_list!(UInt64Builder, UInt64, values, 
size),
-                DataType::Utf8 => build_list!(StringBuilder, Utf8, values, 
size),
-                DataType::Float32 => build_list!(Float32Builder, Float32, 
values, size),
-                DataType::Float64 => build_list!(Float64Builder, Float64, 
values, size),
-                DataType::Timestamp(unit, tz) => {
-                    build_timestamp_list!(unit.clone(), tz.clone(), values, 
size)
-                }
-                &DataType::LargeUtf8 => {
-                    build_list!(LargeStringBuilder, LargeUtf8, values, size)
-                }
-                _ => ScalarValue::iter_to_array_list(
-                    repeat(self.clone()).take(size),
-                    &DataType::List(Arc::new(Field::new(
-                        "item",
-                        field.data_type().clone(),
-                        true,
-                    ))),
-                )
-                .unwrap(),
-            }),
+            ScalarValue::List(arr) => {
+                let arrays = std::iter::repeat(arr.as_ref())
+                    .take(size)
+                    .collect::<Vec<_>>();
+                arrow::compute::concat(arrays.as_slice()).unwrap()

Review Comment:
   I don't fully understand your suggestion. 
   
   I think we can assume the input is ListArray since it is List. For input 
[[1,2,3]] , we will get [[1,2,3], [1,2,3]].
   To do this we can just concat N of arrays.
   



-- 
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]

Reply via email to