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 for loading node ids from node property parquet #1886

Merged
merged 1 commit into from
Dec 4, 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
6 changes: 5 additions & 1 deletion raphtory-cypher/examples/raphtory_cypher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ mod cypher {
#[arg(short, long)]
node_props: Option<String>,

/// Node properties to load
/// Node properties column to load as node type
#[arg(short, long)]
node_type_col: Option<String>,

/// Node properties column to load as node
#[arg(short, long)]
node_id_col: Option<String>,
/// Edge list parquet files to load as layers
#[arg(short='l', last = true, value_parser = parse_key_val::<String, ArgLayer>)]
layers: Vec<(String, ArgLayer)>,
Expand Down Expand Up @@ -196,6 +199,7 @@ mod cypher {
args.t_prop_chunk_size,
args.num_threads,
args.node_type_col.as_deref(),
args.node_id_col.as_deref(),
)
.expect("Failed to load graph");
}
Expand Down
1 change: 1 addition & 0 deletions raphtory-cypher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ mod cypher {
100,
1,
None,
None,
)
.unwrap();

Expand Down
1 change: 1 addition & 0 deletions raphtory/src/disk_graph/graph_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ mod test {
t_props_chunk_size,
num_threads,
node_type_col,
None,
)
.unwrap()
.into_graph();
Expand Down
2 changes: 2 additions & 0 deletions raphtory/src/disk_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ impl DiskGraphStorage {
t_props_chunk_size: usize,
num_threads: usize,
node_type_col: Option<&str>,
node_id_col: Option<&str>,
) -> Result<DiskGraphStorage, RAError> {
let edge_lists: Vec<ExternalEdgeList<&Path>> = layer_parquet_cols
.into_iter()
Expand Down Expand Up @@ -337,6 +338,7 @@ impl DiskGraphStorage {
&[],
node_properties.as_ref().map(|p| p.as_ref()),
node_type_col,
node_id_col,
)?;
Ok(Self::new(t_graph))
}
Expand Down
1 change: 1 addition & 0 deletions raphtory/src/io/arrow/df_loaders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ mod tests {
&[],
None,
None,
None,
)
.unwrap();
let actual =
Expand Down
4 changes: 3 additions & 1 deletion raphtory/src/python/graph/disk_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ impl PyDiskGraph {

#[staticmethod]
#[pyo3(
signature = (graph_dir, layer_parquet_cols, node_properties, chunk_size, t_props_chunk_size, num_threads, node_type_col)
signature = (graph_dir, layer_parquet_cols, node_properties=None, chunk_size=10_000_000, t_props_chunk_size=10_000_000, num_threads=4, node_type_col=None, node_id_col=None)
)]
fn load_from_parquets(
graph_dir: PathBuf,
Expand All @@ -228,6 +228,7 @@ impl PyDiskGraph {
t_props_chunk_size: usize,
num_threads: usize,
node_type_col: Option<&str>,
node_id_col: Option<&str>,
) -> Result<DiskGraphStorage, GraphError> {
let layer_cols = layer_parquet_cols
.iter()
Expand All @@ -241,6 +242,7 @@ impl PyDiskGraph {
t_props_chunk_size,
num_threads,
node_type_col,
node_id_col,
)
.map_err(|err| {
GraphError::LoadFailure(format!("Failed to load graph from parquet files: {err:?}"))
Expand Down
Loading