alamb commented on code in PR #5585:
URL: https://github.com/apache/arrow-datafusion/pull/5585#discussion_r1135659333
##########
datafusion/core/src/dataframe.rs:
##########
@@ -437,19 +416,27 @@ impl DataFrame {
))];
for field in original_schema_fields {
let mut array_datas = vec![];
- for record_batch in describe_record_batch.iter() {
- // safe unwrap since aggregate record batches should have at
least 1 record
- let column =
record_batch.get(0).unwrap().column_by_name(field.name());
- match column {
- Some(c) => {
- if field.data_type().is_numeric() {
- array_datas.push(cast(c, &DataType::Float64)?);
- } else {
- array_datas.push(cast(c, &DataType::Utf8)?);
+ for result in describe_record_batch.iter() {
+ match result {
+ Ok(df) => {
+ let record_batch = df.clone().collect().await?;
+ if record_batch.len() == 1 {
+ if let Some(column) =
+
record_batch.get(0).unwrap().column_by_name(field.name())
+ {
+ if field.data_type().is_numeric() {
+ array_datas.push(cast(column,
&DataType::Float64)?);
+ } else {
+ array_datas.push(cast(column,
&DataType::Utf8)?);
+ }
+ } else {
+ array_datas
+
.push(Arc::new(StringArray::from_slice(["null"])));
+ }
}
}
- //if None mean the column cannot be min/max aggregation
- None => {
+ Err(_) => {
+ //Handling error when only boolean/binary column, and
in other cases
array_datas.push(Arc::new(StringArray::from_slice(["null"])));
Review Comment:
Maybe you can match on the error message
Something like
```rust
Err(e) if e.to_string().contains("message") => {
...
}
_ => {
// Default error
}
```
--
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]