Fix ordering columns bug

This commit is contained in:
Yuriy Dupyn 2024-02-05 22:12:59 +01:00
parent 776740ae3b
commit d28fc85228

View file

@ -59,10 +59,16 @@ impl TableSchema {
}
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()
.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 {