Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support to exclude edge temp properties on import #1814

Merged
merged 2 commits into from
Oct 10, 2024
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
2 changes: 1 addition & 1 deletion pometry-storage-private
7 changes: 7 additions & 0 deletions raphtory-cypher/examples/raphtory_cypher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ mod cypher {
src_col: String,
dst_col: String,
time_col: String,
exclude: Option<Vec<String>>,
}

impl std::str::FromStr for ArgLayer {
Expand Down Expand Up @@ -182,6 +183,7 @@ mod cypher {
src_col,
dst_col,
time_col,
exclude: exclude_edge_props,
},
) = &layers[layer_id];
ParquetLayerCols {
Expand All @@ -190,6 +192,11 @@ mod cypher {
src_col: &src_col,
dst_col: &dst_col,
time_col: &time_col,
exclude_edge_props: exclude_edge_props
.into_iter()
.flatten()
.map(|s| s.as_str())
.collect(),
}
})
.collect();
Expand Down
2 changes: 2 additions & 0 deletions raphtory-cypher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,15 @@ mod cypher {
src_col: "source",
dst_col: "destination",
time_col: "time",
exclude_edge_props: vec!["destination_port"],
},
ParquetLayerCols {
parquet_dir: v1_layer_path.to_str().unwrap(),
layer: "wls",
src_col: "src",
dst_col: "dst",
time_col: "epoch_time",
exclude_edge_props: vec![],
},
];

Expand Down
3 changes: 3 additions & 0 deletions raphtory/src/disk_graph/graph_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub struct ParquetLayerCols<'a> {
pub src_col: &'a str,
pub dst_col: &'a str,
pub time_col: &'a str,
pub exclude_edge_props: Vec<&'a str>,
}

impl Graph {
Expand Down Expand Up @@ -401,13 +402,15 @@ mod test {
src_col: "source",
dst_col: "destination",
time_col: "time",
exclude_edge_props: vec![],
},
ParquetLayerCols {
parquet_dir: v1_layer_path.to_str().unwrap(),
layer: "wls",
src_col: "src",
dst_col: "dst",
time_col: "Time",
exclude_edge_props: vec![],
},
];

Expand Down
14 changes: 11 additions & 3 deletions raphtory/src/disk_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,17 +340,25 @@ impl DiskGraphStorage {
node_type_col: Option<&str>,
) -> Result<DiskGraphStorage, RAError> {
let layered_edge_list: Vec<ExternalEdgeList<&Path>> = layer_parquet_cols
.iter()
.into_iter()
.map(
|ParquetLayerCols {
parquet_dir,
layer,
src_col,
dst_col,
time_col,
exclude_edge_props,
}| {
ExternalEdgeList::new(layer, parquet_dir.as_ref(), src_col, dst_col, time_col)
.expect("Failed to load events")
ExternalEdgeList::new(
layer,
parquet_dir.as_ref(),
src_col,
dst_col,
time_col,
exclude_edge_props,
)
.expect("Failed to load events")
},
)
.collect::<Vec<_>>();
Expand Down
4 changes: 4 additions & 0 deletions raphtory/src/python/graph/disk_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ impl<'a> FromPyObject<'a> for ParquetLayerCols<'a> {
.get_item("time_col")
.and_then(|item| item.expect("time_col is required").extract::<&PyString>())
.and_then(|s| s.to_str())?,
exclude_edge_props: dict.get_item("exclude_edge_props").and_then(|item| {
item.map(|item| item.extract::<Vec<&str>>())
.unwrap_or_else(|| Ok(vec![]))
})?,
})
}
}
Expand Down
Loading