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


##########
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 think you are saying concat 1D list to 2D list? 🤔



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