Skip to content

Commit

Permalink
fix the columns for loading props to graph too
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianmurariu committed Jan 29, 2025
1 parent 7b02347 commit 49cc82c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
17 changes: 4 additions & 13 deletions raphtory/src/io/parquet_loaders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,25 +214,16 @@ pub fn load_edge_deletions_from_parquet<

pub fn load_graph_props_from_parquet<
G: StaticGraphViewOps + InternalPropertyAdditionOps + InternalAdditionOps,
S: AsRef<str>,
>(
graph: &G,
parquet_path: &Path,
time: &str,
properties: Option<&[S]>,
constant_properties: Option<&[S]>,
properties: &[&str],
constant_properties: &[&str],
) -> Result<(), GraphError> {
let properties = properties
.into_iter()
.flat_map(|s| s.into_iter().map(|s| s.as_ref()))
.collect::<Vec<_>>();
let constant_properties = constant_properties
.into_iter()
.flat_map(|s| s.into_iter().map(|s| s.as_ref()))
.collect::<Vec<_>>();
let mut cols_to_check = vec![time];
cols_to_check.extend(&properties);
cols_to_check.extend(&constant_properties);
cols_to_check.extend_from_slice(&properties);
cols_to_check.extend_from_slice(&constant_properties);

for path in get_parquet_file_paths(parquet_path)? {
let df_view = process_parquet_file_to_df(path.as_path(), Some(&cols_to_check))?;
Expand Down
6 changes: 4 additions & 2 deletions raphtory/src/serialise/parquet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ fn decode_graph_storage(
let g_type = {
let exclude = vec![TIME_COL];
let (c_props, g_type) = collect_prop_columns(&c_graph_path, &exclude)?;
load_graph_props_from_parquet(&g, &c_graph_path, TIME_COL, None, Some(&c_props))?;
let c_props = c_props.iter().map(|s| s.as_str()).collect::<Vec<_>>();
load_graph_props_from_parquet(&g, &c_graph_path, TIME_COL, &[], &c_props)?;

g_type.ok_or_else(|| GraphError::LoadFailure("Graph type not found".to_string()))?
};
Expand All @@ -275,7 +276,8 @@ fn decode_graph_storage(
if std::fs::exists(&t_graph_path)? {
let exclude = vec![TIME_COL];
let (t_props, _) = collect_prop_columns(&t_graph_path, &exclude)?;
load_graph_props_from_parquet(&g, &t_graph_path, TIME_COL, Some(&t_props), None)?;
let t_props = t_props.iter().map(|s| s.as_str()).collect::<Vec<_>>();
load_graph_props_from_parquet(&g, &t_graph_path, TIME_COL, &t_props, &[])?;
}

let exclude = vec![TIME_COL, SRC_COL, DST_COL, LAYER_COL];
Expand Down

0 comments on commit 49cc82c

Please sign in to comment.