Skip to content

Commit

Permalink
fixing CI
Browse files Browse the repository at this point in the history
  • Loading branch information
angelip2303 committed Dec 22, 2023
1 parent cc2240a commit 6160032
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 32 deletions.
4 changes: 2 additions & 2 deletions examples/serialize_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<u64>().unwrap()),
)
Expand Down
5 changes: 1 addition & 4 deletions src/dictionary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ impl Dictionary {

pub fn get_predicate_idx(&self, predicate: &str) -> Option<usize> {
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 {
Expand Down
5 changes: 2 additions & 3 deletions src/engine/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ impl EngineStrategy<CsMat<u8>> for ZarrArray {
Ok(&matrix * self)
}

fn get_predicate(&self, value: u8) -> EngineResult<CsMat<u8>> {

fn get_predicate(&self, _value: u8) -> EngineResult<CsMat<u8>> {
unimplemented!()
}

fn get_object(&self, index: usize) -> EngineResult<CsMat<u8>> {
fn get_object(&self, index: usize) -> EngineResult<CsMat<u8>> {
let mut matrix = TriMat::new((self.cols(), self.cols()));
matrix.add_triplet(index, index, 1);
let matrix = matrix.to_csc();
Expand Down
2 changes: 1 addition & 1 deletion src/engine/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl<T: ReadableStorageTraits> EngineStrategy<Vec<u8>> for Array<T> {
}
}

fn get_predicate(&self, index: u8) -> EngineResult<Vec<u8>> {
fn get_predicate(&self, _index: u8) -> EngineResult<Vec<u8>> {
unimplemented!()
}

Expand Down
3 changes: 1 addition & 2 deletions src/storage/tabular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<Chunk>>()
})
.flatten()
.collect::<Vec<Chunk>>()
}

Expand Down
4 changes: 0 additions & 4 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Predicate> for &str {
Expand Down Expand Up @@ -182,8 +181,5 @@ impl Graph {
Predicate::Manufacturer.get_idx(dictionary),
);
ans.to_csc()



}
}
10 changes: 4 additions & 6 deletions tests/get_object_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)
}


19 changes: 9 additions & 10 deletions tests/get_subject_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)
}

0 comments on commit 6160032

Please sign in to comment.