junjunjd commented on code in PR #7901:
URL: https://github.com/apache/arrow-datafusion/pull/7901#discussion_r1381217818


##########
datafusion/common/src/scalar.rs:
##########
@@ -1801,29 +1850,29 @@ impl ScalarValue {
     ///
     /// assert_eq!(result, &expected);
     /// ```
-    pub fn new_list(values: &[ScalarValue], data_type: &DataType) -> ArrayRef {
-        Arc::new(match data_type {
-            DataType::Boolean => build_values_list!(BooleanBuilder, Boolean, 
values, 1),
-            DataType::Int8 => build_values_list!(Int8Builder, Int8, values, 1),
-            DataType::Int16 => build_values_list!(Int16Builder, Int16, values, 
1),
-            DataType::Int32 => build_values_list!(Int32Builder, Int32, values, 
1),
-            DataType::Int64 => build_values_list!(Int64Builder, Int64, values, 
1),
-            DataType::UInt8 => build_values_list!(UInt8Builder, UInt8, values, 
1),
-            DataType::UInt16 => build_values_list!(UInt16Builder, UInt16, 
values, 1),
-            DataType::UInt32 => build_values_list!(UInt32Builder, UInt32, 
values, 1),
-            DataType::UInt64 => build_values_list!(UInt64Builder, UInt64, 
values, 1),
-            DataType::Utf8 => build_values_list!(StringBuilder, Utf8, values, 
1),
+    pub fn new_list(values: &[ScalarValue], data_type: &DataType) -> 
Result<ArrayRef> {
+        Ok(Arc::new(match data_type {
+            DataType::Boolean => build_values_list!(BooleanBuilder, Boolean, 
values, 1)?,
+            DataType::Int8 => build_values_list!(Int8Builder, Int8, values, 
1)?,
+            DataType::Int16 => build_values_list!(Int16Builder, Int16, values, 
1)?,
+            DataType::Int32 => build_values_list!(Int32Builder, Int32, values, 
1)?,
+            DataType::Int64 => build_values_list!(Int64Builder, Int64, values, 
1)?,
+            DataType::UInt8 => build_values_list!(UInt8Builder, UInt8, values, 
1)?,
+            DataType::UInt16 => build_values_list!(UInt16Builder, UInt16, 
values, 1)?,
+            DataType::UInt32 => build_values_list!(UInt32Builder, UInt32, 
values, 1)?,
+            DataType::UInt64 => build_values_list!(UInt64Builder, UInt64, 
values, 1)?,
+            DataType::Utf8 => build_values_list!(StringBuilder, Utf8, values, 
1)?,
             DataType::LargeUtf8 => {
-                build_values_list!(LargeStringBuilder, LargeUtf8, values, 1)
+                build_values_list!(LargeStringBuilder, LargeUtf8, values, 1)?
             }
-            DataType::Float32 => build_values_list!(Float32Builder, Float32, 
values, 1),
-            DataType::Float64 => build_values_list!(Float64Builder, Float64, 
values, 1),
+            DataType::Float32 => build_values_list!(Float32Builder, Float32, 
values, 1)?,
+            DataType::Float64 => build_values_list!(Float64Builder, Float64, 
values, 1)?,
             DataType::Timestamp(unit, tz) => {
                 let values = Some(values);
                 build_timestamp_list!(unit.clone(), tz.clone(), values, 1)
             }
             DataType::List(_) | DataType::Struct(_) => {
-                ScalarValue::iter_to_array_list_without_nulls(values, 
data_type).unwrap()

Review Comment:
   Similar to previous 
[comment](https://github.com/apache/arrow-datafusion/pull/7901/files#r1381174929),
 this error is reachable if `values` are decimals with precision 0. 



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