junjunjd commented on code in PR #7901:
URL: https://github.com/apache/arrow-datafusion/pull/7901#discussion_r1381221881
##########
datafusion/common/src/scalar.rs:
##########
@@ -1834,30 +1883,31 @@ impl ScalarValue {
}
let arr = Decimal128Array::from(vals)
- .with_precision_and_scale(*precision, *scale)
- .unwrap();
+ .with_precision_and_scale(*precision, *scale)?;
wrap_into_list_array(Arc::new(arr))
}
DataType::Null => {
let arr = new_null_array(&DataType::Null, values.len());
wrap_into_list_array(arr)
}
- _ => panic!(
- "Unsupported data type {:?} for ScalarValue::list_to_array",
- data_type
- ),
- })
+ _ => {
+ return _internal_err!(
+ "Unsupported data type {:?} for
ScalarValue::list_to_array",
+ data_type
+ )
+ }
+ }))
}
/// Converts a scalar value into an array of `size` rows.
- pub fn to_array_of_size(&self, size: usize) -> ArrayRef {
- match self {
+ pub fn to_array_of_size(&self, size: usize) -> Result<ArrayRef> {
+ Ok(match self {
ScalarValue::Decimal128(e, precision, scale) => Arc::new(
- ScalarValue::build_decimal_array(*e, *precision, *scale, size),
Review Comment:
See previous
[comment](https://github.com/apache/arrow-datafusion/pull/7901/files#r1381174929).
--
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]