Skip to content
Open
Show file tree
Hide file tree
Changes from 10 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
27 changes: 26 additions & 1 deletion libgalois/include/katana/PropertyGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,14 @@ class KATANA_EXPORT PropertyGraph {
/// The edge EntityTypeID for each edge's most specific type
katana::NUMAArray<EntityTypeID> edge_entity_type_id_;

// List of node and edge indexes on this graph.
// List of node and edge indexes on this graph. And the columns that created them to persist in json
std::vector<std::unique_ptr<PropertyIndex<GraphTopology::Node>>>
node_indexes_;
std::vector<std::string> node_property_indexes_column_name;

std::vector<std::unique_ptr<PropertyIndex<GraphTopology::Edge>>>
edge_indexes_;
std::vector<std::string> edge_property_indexes_column_name;

// Keep partition_metadata, master_nodes, mirror_nodes out of the public interface,
// while allowing Distribution to read/write it for RDG
Expand Down Expand Up @@ -144,6 +147,28 @@ class KATANA_EXPORT PropertyGraph {
return rdg_.edge_properties();
}

// recreate indexes from json
void recreate_node_property_indexes() {
node_property_indexes_column_name =
rdg_.get_node_property_indexes_column_name();
for (const std::string column_name : node_property_indexes_column_name) {
auto result = MakeNodeIndex(column_name);
if (!result) {
return (void)result.error();
}
}
}
void recreate_edge_property_indexes() {
edge_property_indexes_column_name =
rdg_.get_edge_property_indexes_column_name();
for (const std::string column_name : edge_property_indexes_column_name) {
auto result = MakeEdgeIndex(column_name);
if (!result) {
return (void)result.error();
}
}
}

public:
/// PropertyView provides a uniform interface when you don't need to
/// distinguish operating on edge or node properties
Expand Down
17 changes: 16 additions & 1 deletion libgalois/src/PropertyGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,11 @@ katana::PropertyGraph::Make(
return topo_result.error();
}

return std::make_unique<PropertyGraph>(
auto property_graph = std::make_unique<PropertyGraph>(
std::move(rdg_file), std::move(rdg), std::move(topo_result.value()));
property_graph->recreate_node_property_indexes();
property_graph->recreate_edge_property_indexes();
return property_graph;
}

katana::Result<std::unique_ptr<katana::PropertyGraph>>
Expand Down Expand Up @@ -868,6 +871,12 @@ katana::PropertyGraph::MakeNodeIndex(const std::string& column_name) {

node_indexes_.push_back(std::move(index));

//save the column name the index was created from for easy assess dudring json load/store
node_property_indexes_column_name.push_back(column_name);

//persist column names to json, index can now can be recreated using recreate_node_property_indexes()
rdg_.set_node_property_indexes_column_name(node_property_indexes_column_name);

return katana::ResultSuccess();
}

Expand Down Expand Up @@ -901,6 +910,12 @@ katana::PropertyGraph::MakeEdgeIndex(const std::string& column_name) {

edge_indexes_.push_back(std::move(index));

//save the column name the index was created from for easy assess dudring json load/store
edge_property_indexes_column_name.push_back(column_name);

//persist column names to json, index can now can be recreated using recreate_edge_property_indexes()
rdg_.set_edge_property_indexes_column_name(edge_property_indexes_column_name);

return katana::ResultSuccess();
}

Expand Down
10 changes: 10 additions & 0 deletions libtsuba/include/tsuba/RDG.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ class KATANA_EXPORT RDG {
/// Remove all edge properties
void DropEdgeProperties();

//write the list of node and edge column names persisted to json, private as it is called only when the node and edge property index vectors are pushed back
void set_node_property_indexes_column_name(
std::vector<std::string>& node_property_indexes_column_name);
void set_edge_property_indexes_column_name(
std::vector<std::string>& edge_property_indexes_column_name);

// read the same as above and recreate indexes
std::vector<std::string>& get_node_property_indexes_column_name();
std::vector<std::string>& get_edge_property_indexes_column_name();

std::shared_ptr<arrow::Schema> full_node_schema() const;

std::shared_ptr<arrow::Schema> full_edge_schema() const;
Expand Down
23 changes: 23 additions & 0 deletions libtsuba/src/RDG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,29 @@ tsuba::RDG::WritePartArrays(const katana::Uri& dir, tsuba::WriteGroup* desc) {
return next_properties;
}

//write the list of node and edge column names persisted to json, private as it is called only when the node and edge property index vectors are pushed back
void
tsuba::RDG::set_node_property_indexes_column_name(
std::vector<std::string>& node_property_indexes_column_name) {
core_->part_header().set_node_property_indexes_column_name(
node_property_indexes_column_name);
}
void
tsuba::RDG::set_edge_property_indexes_column_name(
std::vector<std::string>& edge_property_indexes_column_name) {
core_->part_header().set_edge_property_indexes_column_name(
edge_property_indexes_column_name);
}
// read the same as above and recreate indexes
std::vector<std::string>&
tsuba::RDG::get_node_property_indexes_column_name() {
return core_->part_header().node_property_indexes_column_name();
}
std::vector<std::string>&
tsuba::RDG::get_edge_property_indexes_column_name() {
return core_->part_header().edge_property_indexes_column_name();
}

katana::Result<void>
tsuba::RDG::DoStore(
RDGHandle handle, const std::string& command_line,
Expand Down
30 changes: 30 additions & 0 deletions libtsuba/src/RDGPartHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,30 @@ class KATANA_EXPORT RDGPartHeader {
part_prop_info_list_ = std::move(part_prop_info_list);
}

const std::vector<std::string>& node_property_indexes_column_name() const {
return node_property_indexes_column_name_;
}
std::vector<std::string>& node_property_indexes_column_name() {
return node_property_indexes_column_name_;
}
void set_node_property_indexes_column_name(
std::vector<std::string>& node_property_indexes_column_name) {
node_property_indexes_column_name_ =
std::move(node_property_indexes_column_name);
}

const std::vector<std::string>& edge_property_indexes_column_name() const {
return edge_property_indexes_column_name_;
}
std::vector<std::string>& edge_property_indexes_column_name() {
return edge_property_indexes_column_name_;
}
void set_edge_property_indexes_column_name(
std::vector<std::string>& edge_property_indexes_column_name) {
edge_property_indexes_column_name_ =
std::move(edge_property_indexes_column_name);
}

const PartitionMetadata& metadata() const { return metadata_; }
void set_metadata(const PartitionMetadata& metadata) { metadata_ = metadata; }

Expand Down Expand Up @@ -311,6 +335,12 @@ class KATANA_EXPORT RDGPartHeader {
std::vector<PropStorageInfo> node_prop_info_list_;
std::vector<PropStorageInfo> edge_prop_info_list_;

/// Column Names to create property index from on startup
std::vector<std::string>
node_property_indexes_column_name_; //nhomann serializes this automagically. to/from json required if column name type is (in the future) changed from string to a custom one
std::vector<std::string>
edge_property_indexes_column_name_; //nhomann serializes this automagically. to/from json required if column name type is (in the future) changed from string to a custom one

/// Metadata filled in by CuSP, or from storage (meta partition file)
PartitionMetadata metadata_;

Expand Down