Skip to content

Commit a3070bf

Browse files
committed
fix: ordering
1 parent 1c5575c commit a3070bf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

crates/nu-engine/src/column.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@ use nu_protocol::Value;
22
use std::collections::HashSet;
33

44
pub fn get_columns(input: &[Value]) -> Vec<String> {
5-
let mut columns = HashSet::new();
5+
let mut column_set = HashSet::new();
6+
let mut columns = Vec::new();
67
for item in input {
78
let Value::Record { val, .. } = item else {
89
return vec![];
910
};
1011

1112
for col in val.columns() {
12-
columns.insert(col.to_string());
13+
if column_set.insert(col) {
14+
columns.push(col.to_string());
15+
}
1316
}
1417
}
1518

16-
columns.into_iter().collect()
19+
columns
1720
}
1821

1922
// If a column doesn't exist in the input, return it.

0 commit comments

Comments
 (0)