Skip to content

Commit

Permalink
fix incorrect sqlite equivalences and use btree instead of hash colle…
Browse files Browse the repository at this point in the history
…ctions in id2group
  • Loading branch information
jamesamcl committed Jul 31, 2024
1 parent 4a927ca commit 0fbd15c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion 01_ingest/grebi_ingest_sqlite/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ fn main() -> Result<()> {

if fk_info.is_some() {
json_obj[&col_name] = json!(format!("{}:{}:{}", prefix, fk_info.unwrap().0.to_singular(), v));
ids.push(format!("{}:{}:{}", fk_info.unwrap().0.to_singular(), prefix, v));
} else {
json_obj[&col_name] = json!(v);
}
Expand Down
8 changes: 4 additions & 4 deletions 02_assign_ids/grebi_identifiers2groups/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

use std::collections::{HashSet, HashMap, BTreeMap};
use std::collections::{BTreeSet, BTreeMap};
use std::{env, io};
use csv;
use bloomfilter::Bloom;
Expand All @@ -21,15 +21,15 @@ struct Args {

fn main() {

let mut group_to_entities:BTreeMap<u64, HashSet<Vec<u8>>> = BTreeMap::new();
let mut group_to_entities:BTreeMap<u64, BTreeSet<Vec<u8>>> = BTreeMap::new();
let mut entity_to_group:BTreeMap<Vec<u8>, u64> = BTreeMap::new();

let mut next_group_id:u64 = 1;

let args = Args::parse();
let add_group:Vec<String> = args.add_group;
for group in add_group {
let entries:HashSet<Vec<u8>> = group.split(",").map(|s| s.as_bytes().to_vec()).collect();
let entries:BTreeSet<Vec<u8>> = group.split(",").map(|s| s.as_bytes().to_vec()).collect();
let gid = next_group_id;
next_group_id = next_group_id + 1;
for id in &entries {
Expand Down Expand Up @@ -103,7 +103,7 @@ fn main() {
for id in &ids {
entity_to_group.insert(id.to_vec(), target_group);
}
group_to_entities.insert(target_group, ids.iter().map(|id| id.to_vec()).collect::<HashSet<_>>());
group_to_entities.insert(target_group, ids.iter().map(|id| id.to_vec()).collect::<BTreeSet<_>>());
}
}

Expand Down

0 comments on commit 0fbd15c

Please sign in to comment.