Fix ordering columns bug
This commit is contained in:
parent
776740ae3b
commit
d28fc85228
1 changed files with 9 additions and 3 deletions
|
|
@ -59,10 +59,16 @@ impl TableSchema {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_columns(&self) -> Vec<&ColumnName> {
|
pub fn get_columns(&self) -> Vec<&ColumnName> {
|
||||||
self.column_name_position_mapping
|
let mut columns_in_random_order: Vec<_> = self.column_name_position_mapping
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(name, _)| name)
|
.collect();
|
||||||
.collect()
|
columns_in_random_order.sort_by(|&(_, column0), &(_, column1)| column0.cmp(column1));
|
||||||
|
|
||||||
|
let columns: Vec<_> = columns_in_random_order
|
||||||
|
.iter()
|
||||||
|
.map(|(name, _)| *name)
|
||||||
|
.collect();
|
||||||
|
columns
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn does_column_exist(&self, column_name: &ColumnName) -> bool {
|
pub fn does_column_exist(&self, column_name: &ColumnName) -> bool {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue