chingren-ooi commented on issue #10231:
URL: https://github.com/apache/datafusion/issues/10231#issuecomment-2078600222

   Hey, I've successfully obtained the correct output following your advice. 
Can we expect any update or fix to the current `describe()` functionality? 
   
   ```
   use datafusion::logical_expr::aggregate_function;
   use datafusion::logical_expr::expr::AggregateFunction;
   ```
   
   ```
   fn count_null(expr: Expr) -> Expr {
       Expr::AggregateFunction(AggregateFunction::new(
           aggregate_function::AggregateFunction::Count,
           vec![expr.clone()],
           false,
           Some(Box::new(expr.is_null())),
           None,
           None,
       ))
   }
   ```
   
   ```
   // null_count aggregation
   df.clone().aggregate(
       vec![],
       original_schema_fields
           .clone()
           .filter(|f| f.data_type().is_numeric())
           .map(|f| count_null(is_null(col(f.name()))).alias(f.name()))
           .collect::<Vec<_>>(),
   ),
   ```
   
   ```
   +----------------+------+-------------------+------+
   | describe       | car  | speed             | time |
   +----------------+------+-------------------+------+
   | count          | null | 25.0              | null |
   | null_count     | null | 0.0               | null |
   | mean           | null | 11.84             | null |
   | std            | null | 6.456456716600317 | null |
   | min            | null | 0.0               | null |
   | max            | null | 21.5              | null |
   | median         | null | 11.0              | null |
   +----------------+------+-------------------+------+
   ```


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to