From 6160032601b8677a831dda0de0006f3a5101805d Mon Sep 17 00:00:00 2001 From: angelip2303 Date: Fri, 22 Dec 2023 12:42:03 +0000 Subject: [PATCH] fixing CI --- examples/serialize_bench.rs | 4 ++-- src/dictionary.rs | 5 +---- src/engine/array.rs | 5 ++--- src/engine/chunk.rs | 2 +- src/storage/tabular.rs | 3 +-- tests/common/mod.rs | 4 ---- tests/get_object_test.rs | 10 ++++------ tests/get_subject_test.rs | 19 +++++++++---------- 8 files changed, 20 insertions(+), 32 deletions(-) diff --git a/examples/serialize_bench.rs b/examples/serialize_bench.rs index 8ded640..d9ee85c 100644 --- a/examples/serialize_bench.rs +++ b/examples/serialize_bench.rs @@ -16,12 +16,12 @@ fn main() { let rdf_path: &String = &args[1]; let zarr_path: &String = &args[2]; let shard_size: &String = &args[3]; - + let before = Instant::now(); LocalStorage::new(MatrixLayout) .serialize( - &zarr_path.as_str(), + &zarr_path.as_str(), &rdf_path.as_str(), ChunkingStrategy::Sharding(shard_size.parse::().unwrap()), ) diff --git a/src/dictionary.rs b/src/dictionary.rs index aa1a401..6a74608 100644 --- a/src/dictionary.rs +++ b/src/dictionary.rs @@ -77,10 +77,7 @@ impl Dictionary { pub fn get_predicate_idx(&self, predicate: &str) -> Option { let mut locator = self.predicates.locator(); - match locator.run(predicate) { - Some(value) => Some(value + 1), - None => None, - } + locator.run(predicate).map(|value| value + 1) } pub fn get_predicate_idx_unchecked(&self, predicate: &str) -> usize { diff --git a/src/engine/array.rs b/src/engine/array.rs index e054598..5ca2f5d 100644 --- a/src/engine/array.rs +++ b/src/engine/array.rs @@ -12,12 +12,11 @@ impl EngineStrategy> for ZarrArray { Ok(&matrix * self) } - fn get_predicate(&self, value: u8) -> EngineResult> { - + fn get_predicate(&self, _value: u8) -> EngineResult> { unimplemented!() } - fn get_object(&self, index: usize) -> EngineResult> { + fn get_object(&self, index: usize) -> EngineResult> { let mut matrix = TriMat::new((self.cols(), self.cols())); matrix.add_triplet(index, index, 1); let matrix = matrix.to_csc(); diff --git a/src/engine/chunk.rs b/src/engine/chunk.rs index 7ab3c58..1761804 100644 --- a/src/engine/chunk.rs +++ b/src/engine/chunk.rs @@ -23,7 +23,7 @@ impl EngineStrategy> for Array { } } - fn get_predicate(&self, index: u8) -> EngineResult> { + fn get_predicate(&self, _index: u8) -> EngineResult> { unimplemented!() } diff --git a/src/storage/tabular.rs b/src/storage/tabular.rs index 853dfda..8cca3f1 100644 --- a/src/storage/tabular.rs +++ b/src/storage/tabular.rs @@ -80,13 +80,12 @@ where graph .iter() .enumerate() - .map(|(subject, triples)| { + .flat_map(|(subject, triples)| { triples .iter() .map(|&(predicate, object)| (subject as u32, predicate, object)) .collect::>() }) - .flatten() .collect::>() } diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 05192ed..3f08f76 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -68,7 +68,6 @@ impl Predicate { pub fn get_idx(self, dictionary: &Dictionary) -> u8 { dictionary.get_predicate_idx_unchecked(self.into()) as u8 } - } impl From for &str { @@ -182,8 +181,5 @@ impl Graph { Predicate::Manufacturer.get_idx(dictionary), ); ans.to_csc() - - - } } diff --git a/tests/get_object_test.rs b/tests/get_object_test.rs index e256826..15bfd4e 100644 --- a/tests/get_object_test.rs +++ b/tests/get_object_test.rs @@ -2,7 +2,7 @@ use remote_hdt::{ engine::EngineStrategy, storage::{matrix::MatrixLayout, tabular::TabularLayout, ChunkingStrategy, LocalStorage}, }; -use sprs:: TriMat; +use sprs::TriMat; mod common; #[test] @@ -48,10 +48,8 @@ fn get_object_tabular_test() { .get_object(common::Object::Alan.get_idx(&storage.get_dictionary())) .unwrap(); - let mut expected = TriMat::new((4,9)); - expected.add_triplet(1,3,3); + let mut expected = TriMat::new((4, 9)); + expected.add_triplet(1, 3, 3); let expected = expected.to_csc(); - assert_eq!(actual, expected ) + assert_eq!(actual, expected) } - - diff --git a/tests/get_subject_test.rs b/tests/get_subject_test.rs index bd1e779..4a8d5fb 100644 --- a/tests/get_subject_test.rs +++ b/tests/get_subject_test.rs @@ -2,7 +2,7 @@ use remote_hdt::{ engine::EngineStrategy, storage::{matrix::MatrixLayout, tabular::TabularLayout, ChunkingStrategy, LocalStorage}, }; -use sprs:: TriMat; +use sprs::TriMat; mod common; #[test] @@ -48,13 +48,12 @@ fn get_subject_tabular_test() { .get_subject(common::Subject::Alan.get_idx(&storage.get_dictionary())) .unwrap(); - let mut result = TriMat::new((4,9)); - result.add_triplet(0,0,2); - result.add_triplet(0,1,4); - result.add_triplet(0,2,5); - result.add_triplet(0,7,7); - result.add_triplet(0,8,8); - let result = result.to_csc(); - assert_eq!(actual, result) + let mut result = TriMat::new((4, 9)); + result.add_triplet(0, 0, 2); + result.add_triplet(0, 1, 4); + result.add_triplet(0, 2, 5); + result.add_triplet(0, 7, 7); + result.add_triplet(0, 8, 8); + let result = result.to_csc(); + assert_eq!(actual, result) } -