Skip to content

Commit

Permalink
fixing the clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
angelip2303 committed Jun 27, 2023
1 parent 93d6787 commit df5f9fd
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 32 deletions.
70 changes: 41 additions & 29 deletions src/backends/ntriples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,47 +64,59 @@ impl Backend for NTriples {
Err(_) => return Err(format!("Error retrieving the {}th row", i)),
};

if let Err(_) = formatter.format(&Triple {
subject: match row.get(0) {
Some(subject) => match subject {
AnyValue::Utf8(iri) => NamedNode {
iri: &iri[1..iri.len() - 1],
if formatter
.format(&Triple {
subject: match row.get(0) {
Some(subject) => match subject {
AnyValue::Utf8(iri) => NamedNode {
iri: &iri[1..iri.len() - 1],
}
.into(),
_ => {
return Err(format!("Cannot parse from non-string at {}th row", i))
}
},
None => {
return Err(format!("Error obtaining the subject of the {}th row", i))
}
.into(),
_ => return Err(format!("Cannot parse from non-string at {}th row", i)),
},
None => return Err(format!("Error obtaining the subject of the {}th row", i)),
},
predicate: match row.get(1) {
Some(predicate) => match predicate {
AnyValue::Utf8(iri) => NamedNode {
iri: &iri[1..iri.len() - 1],
predicate: match row.get(1) {
Some(predicate) => match predicate {
AnyValue::Utf8(iri) => NamedNode {
iri: &iri[1..iri.len() - 1],
},
_ => {
return Err(format!("Cannot parse from non-string at {}th row", i))
}
},
None => {
return Err(format!("Error obtaining the predicate of the {}th row", i))
}
.into(),
_ => return Err(format!("Cannot parse from non-string at {}th row", i)),
},
None => {
return Err(format!("Error obtaining the predicate of the {}th row", i))
}
},
object: match row.get(2) {
Some(object) => match object {
AnyValue::Utf8(iri) => NamedNode {
iri: &iri[1..iri.len() - 1],
object: match row.get(2) {
Some(object) => match object {
AnyValue::Utf8(iri) => NamedNode {
iri: &iri[1..iri.len() - 1],
}
.into(),
_ => {
return Err(format!("Cannot parse from non-string at {}th row", i))
}
},
None => {
return Err(format!("Error obtaining the object of the {}th row", i))
}
.into(),
_ => return Err(format!("Cannot parse from non-string at {}th row", i)),
},
None => return Err(format!("Error obtaining the object of the {}th row", i)),
},
}) {
})
.is_err()
{
return Err(format!("Error parsing the {}th row", i));
}
}

match formatter.finish() {
Ok(_) => Ok(()),
Err(_) => return Err(format!("Error storing the results to the file")),
Err(_) => Err(String::from("Error storing the results to the file")),
}
}
}
4 changes: 2 additions & 2 deletions src/backends/parquet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ impl Backend for Parquet {
todo!()
}

fn export(path: &str, mut df: &mut DataFrame) -> Result<(), String> {
fn export(path: &str, df: &mut DataFrame) -> Result<(), String> {
let buffer = match File::create(path) {
Ok(buffer) => buffer,
Err(_) => return Err(String::from("Error creating the Parquet file")),
};

match ParquetWriter::new(buffer).finish(&mut df) {
match ParquetWriter::new(buffer).finish(df) {
Ok(_) => Ok(()),
Err(_) => Err(String::from("Error writing to the Parquet file")),
}
Expand Down
2 changes: 1 addition & 1 deletion src/pschema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl<T: Literal + Clone> PSchema<T> {
.gt(lit(0)),
)
.left_join(
graph.to_owned().edges.lazy(),
graph.edges.lazy(),
Column::VertexId.as_ref(),
Column::Subject.as_ref(),
)
Expand Down

0 comments on commit df5f9fd

Please sign in to comment.