Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/indexing/dense.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,16 @@ impl DenseIndexBuilder {
}
}


#[doc=""]
pub fn build_dense_index(
log_path: &str,
index_path: &str,
) -> std::io::Result<()> {
#[doc = ""]
pub fn build_dense_index(log_path: &str, index_path: &str) -> std::io::Result<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you prefer writing in single line than 2 different? Two different ones have better readability

let mut log = File::open(log_path)?;
let mut builder = DenseIndexBuilder::create(index_path)?;

let mut offset = 0u64;
let mut record = [0u8; RECORD_SIZE];

while log.read_exact(&mut record).is_ok(){
let (timestamp, _, _ , _, _ ) = decode_record(&record);
while log.read_exact(&mut record).is_ok() {
let (timestamp, _, _, _, _) = decode_record(&record);
builder.add_entry(timestamp, offset)?;
offset += RECORD_SIZE as u64;
}
Expand Down
2 changes: 1 addition & 1 deletion src/indexing/dictionary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl Dictionary {
file.read_exact(&mut count_bytes)?;
let count = u64::from_be_bytes(count_bytes);

// Reading each IRI Entry
// Reading each URI Entry

for id in 0..count {
let mut len_bytes = [0u8; 4];
Expand Down
12 changes: 6 additions & 6 deletions src/indexing/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#[doc=""]
pub mod shared;
#[doc=""]
#[doc = ""]
pub mod dense;
#[doc=""]
pub mod sparse;
#[doc=""]
#[doc = ""]
pub mod dictionary;
#[doc = ""]
pub mod shared;
#[doc = ""]
pub mod sparse;
8 changes: 4 additions & 4 deletions src/indexing/shared.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::indexing::dictionary::Dictionary;
use std::fs::File;
use std::io::Write;
use crate::indexing::dictionary::Dictionary;

#[doc = ""]
pub const RECORD_SIZE: usize = 40;
Expand Down Expand Up @@ -93,7 +93,7 @@ pub struct Event {
}

#[derive(Debug, Clone)]
pub struct ResolvedEvent{
pub struct ResolvedEvent {
pub timestamp: u64,
pub subject: String,
pub predicate: String,
Expand All @@ -108,7 +108,7 @@ impl Event {
subject: dict.fetch_uri(self.subject).unwrap_or("UNKNOWN").to_string(),
predicate: dict.fetch_uri(self.predicate).unwrap_or("UNKNOWN").to_string(),
object: dict.fetch_uri(self.object).unwrap_or("UNKNOWN").to_string(),
graph: dict.fetch_uri(self.graph).unwrap_or("UNKNOWN").to_string()
}
graph: dict.fetch_uri(self.graph).unwrap_or("UNKNOWN").to_string(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you always need an extra , even if there is nothing else after it? Why?

}
}
}
2 changes: 1 addition & 1 deletion src/indexing/sparse.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::indexing::dictionary::{self, Dictionary};
use crate::indexing::dictionary::Dictionary;
use crate::indexing::shared::{decode_record, Event, ResolvedEvent, RECORD_SIZE};
use std::fs::File;
use std::io::{Read, Seek, SeekFrom, Write};
Expand Down
2 changes: 1 addition & 1 deletion src/parsing/janusql_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ mod tests {
}

#[test]
fn test_mixed_windows(){
fn test_mixed_windows() {
let parser = JanusQLParser::new().unwrap();
let query = r#"
PREFIX sensor: <https://rsp.js/sensors/>
Expand Down