alamb commented on code in PR #8261:
URL: https://github.com/apache/arrow-datafusion/pull/8261#discussion_r1399316816
##########
datafusion/common/src/scalar.rs:
##########
@@ -2889,12 +2890,21 @@ impl fmt::Display for ScalarValue {
)?,
None => write!(f, "NULL")?,
},
- ScalarValue::List(arr) | ScalarValue::FixedSizeList(arr) => write!(
- f,
- "{}",
- arrow::util::pretty::pretty_format_columns("col",
&[arr.to_owned()])
- .unwrap()
- )?,
+ ScalarValue::List(arr) | ScalarValue::FixedSizeList(arr) => {
+ // TODO: Remove NullArray
+ // There are NullArray(0) currently, so we need to check the
length
+ if arr.len() == 0 {
+ write!(f, "[]")?
+ } else {
+ let options =
FormatOptions::default().with_display_error(true);
+ // TODO: No way to map to fmt::Error yet
Review Comment:
https://docs.rs/arrow/latest/arrow/util/display/struct.ArrayFormatter.html#method.try_new
says it returns an error if the type can't be formatted. Since this code knows
that it is always a ListArray I think it would be ok to simply unwrap the error
(`ArrayFormatter::try_new(...).unwrap()`)
--
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]