Handle empty columns in schema summary too
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Guillem Borrell 2023-01-17 12:36:09 +00:00
parent 59adb12078
commit 1858777c69

View file

@ -5,8 +5,15 @@ use sea_query::*;
pub fn print_schema(ldf: LazyFrame) { pub fn print_schema(ldf: LazyFrame) {
let schema = ldf.schema().expect("Could not retreive schema"); let schema = ldf.schema().expect("Could not retreive schema");
for f in schema.iter_fields() { for f in schema.iter_fields() {
let n = f.name(); let mut unnamed_cols_counter = 0;
let d = f.data_type().to_string(); let d = f.data_type().to_string();
let n = if f.name.is_empty() {
unnamed_cols_counter += 1;
format!("Column{}", unnamed_cols_counter)
} else {
f.name
};
println!("{n} ({d})"); println!("{n} ({d})");
} }
} }