946: Sort displayedAttributes field r=MarinPostma a=gorogoroumaru

Fix #943

displayedAttributes use the HashSet struct which is an unsorted structure, so I changed the implementation from HashSet into BTreeSet.

Co-authored-by: gorogoroumaru <zokutyou2@gmail.com>
This commit is contained in:
bors[bot]
2020-10-13 14:37:47 +00:00
committed by GitHub
8 changed files with 96 additions and 11 deletions

View File

@ -1,4 +1,5 @@
use std::collections::hash_map::{Entry, HashMap};
use std::collections::BTreeMap;
use std::fs::File;
use std::path::Path;
use std::sync::{Arc, RwLock};
@ -577,7 +578,7 @@ impl Database {
}
// convert attributes to their names
let frequency: HashMap<_, _> = fields_frequency
let frequency: BTreeMap<_, _> = fields_frequency
.into_iter()
.filter_map(|(a, c)| schema.name(a).map(|name| (name.to_string(), c)))
.collect();