Skip to content

Commit 9d0fafe

Browse files
committed
add a describe method on DataFrame like Polars
1 parent 26733d4 commit 9d0fafe

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

datafusion/core/src/dataframe.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,16 @@ impl DataFrame {
307307
let df = self.clone();
308308
let mut aggr_expr: Vec<Expr> = vec![];
309309
aggr_expr.push(datafusion_expr::count(col(field.name())));
310+
let mut rs = vec![];
310311
match field.data_type().is_numeric() {
311312
true => {
312313
aggr_expr.push(datafusion_expr::min(col(field.name())));
313314
aggr_expr.push(datafusion_expr::max(col(field.name())));
314315
}
315-
false => {}
316+
false => {
317+
rs.push("null".to_string());
318+
rs.push("null".to_string());
319+
}
316320
}
317321

318322
let df = df
@@ -322,15 +326,7 @@ impl DataFrame {
322326
.await
323327
.unwrap();
324328

325-
let mut rs = vec![];
326329
for batch in df {
327-
match batch.num_columns() {
328-
1 => {
329-
rs.push("null".to_string());
330-
rs.push("null".to_string());
331-
}
332-
_ => {}
333-
}
334330
for col in 0..batch.num_columns() {
335331
let column = batch.column(col);
336332
let val = array_value_to_string(column, 0).unwrap();

0 commit comments

Comments
 (0)