From 6635e50e53a7970cc4f19fd9fef52edca3f00fed Mon Sep 17 00:00:00 2001 From: sholderbach Date: Fri, 12 Jul 2024 11:17:07 +0200 Subject: [PATCH] Do not alter column names in `select` Fixes #13359 In an attempt to generate names for flat columns resulting from a nested accesses #3016 generated new column names on nested selection, out of convenience, that composed the cell path as a string (including `.`) and then simply replaced all `.` with `_`. As we permit `.` in column names as long as you quote this surprisingly alters `select`ed columns. --- crates/nu-command/src/filters/select.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/nu-command/src/filters/select.rs b/crates/nu-command/src/filters/select.rs index 2ca04b3999..2fe4da3c36 100644 --- a/crates/nu-command/src/filters/select.rs +++ b/crates/nu-command/src/filters/select.rs @@ -240,7 +240,7 @@ fn select( //FIXME: improve implementation to not clone match input_val.clone().follow_cell_path(&path.members, false) { Ok(fetcher) => { - record.push(path.to_string().replace('.', "_"), fetcher); + record.push(path.to_string(), fetcher); if !columns_with_value.contains(&path) { columns_with_value.push(path); } @@ -271,7 +271,7 @@ fn select( // FIXME: remove clone match v.clone().follow_cell_path(&cell_path.members, false) { Ok(result) => { - record.push(cell_path.to_string().replace('.', "_"), result); + record.push(cell_path.to_string(), result); } Err(e) => return Err(e), } @@ -295,7 +295,7 @@ fn select( //FIXME: improve implementation to not clone match x.clone().follow_cell_path(&path.members, false) { Ok(value) => { - record.push(path.to_string().replace('.', "_"), value); + record.push(path.to_string(), value); } Err(e) => return Err(e), }