forked from extern/nushell
Flatten rows containing same sub-table columns with distinct column names. (#2684)
This commit is contained in:
committed by
GitHub
parent
b6d19cc9fa
commit
5725e55abb
@ -100,12 +100,20 @@ fn flat_value(
|
||||
} = value
|
||||
{
|
||||
if column_requested.is_none() && !columns.is_empty() {
|
||||
out.insert_value(column, value.clone());
|
||||
if out.contains_key(&column) {
|
||||
out.insert_value(format!("{}_{}", column, column), value.clone());
|
||||
} else {
|
||||
out.insert_value(column, value.clone());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
for (k, v) in mapa.into_iter() {
|
||||
out.insert_value(k, v.clone());
|
||||
if out.contains_key(k) {
|
||||
out.insert_value(format!("{}_{}", column, k), v.clone());
|
||||
} else {
|
||||
out.insert_value(k, v.clone());
|
||||
}
|
||||
}
|
||||
} else if value.is_table() {
|
||||
if tables_explicitly_flattened >= 1 && column_requested.is_some() {
|
||||
|
Reference in New Issue
Block a user