Skip to content

Commit

Permalink
feat(format):rename 'label' as 'type' in some .cc and .h files (apach…
Browse files Browse the repository at this point in the history
…e#606)


Signed-off-by: Elssky <[email protected]>
Co-authored-by: acezen <[email protected]>
  • Loading branch information
Elssky and acezen committed Sep 23, 2024
1 parent 232569e commit c259a37
Show file tree
Hide file tree
Showing 24 changed files with 138 additions and 134 deletions.
2 changes: 2 additions & 0 deletions cpp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/build/
/build-test/
/build-test-rename/
/examples/*/build/
/cmake-build-debug

Expand Down
8 changes: 4 additions & 4 deletions cpp/examples/bfs_father_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ int main(int argc, char* argv[]) {
auto graph_info = graphar::GraphInfo::Load(path).value();

// get the person vertices of graph
std::string label = "person";
ASSERT(graph_info->GetVertexInfo(label) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, label);
std::string type = "person";
ASSERT(graph_info->GetVertexInfo(type) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, type);
ASSERT(maybe_vertices.status().ok());
auto vertices = maybe_vertices.value();
int num_vertices = vertices->size();
Expand Down Expand Up @@ -86,7 +86,7 @@ int main(int argc, char* argv[]) {
graphar::CreatePropertyGroup(property_vector, graphar::FileType::CSV);

// extend the vertex_info
auto vertex_info = graph_info->GetVertexInfo(label);
auto vertex_info = graph_info->GetVertexInfo(type);
auto maybe_extend_info = vertex_info->AddPropertyGroup(group);
ASSERT(maybe_extend_info.status().ok());
auto extend_info = maybe_extend_info.value();
Expand Down
8 changes: 4 additions & 4 deletions cpp/examples/bfs_pull_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ int main(int argc, char* argv[]) {
auto graph_info = graphar::GraphInfo::Load(path).value();

// construct vertices collection
std::string label = "person";
ASSERT(graph_info->GetVertexInfo(label) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, label);
std::string type = "person";
ASSERT(graph_info->GetVertexInfo(type) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, type);
ASSERT(maybe_vertices.status().ok());
auto& vertices = maybe_vertices.value();
int num_vertices = vertices->size();
Expand Down Expand Up @@ -88,7 +88,7 @@ int main(int argc, char* argv[]) {
auto group =
graphar::CreatePropertyGroup(property_vector, graphar::FileType::PARQUET);
// extend the vertex_info
auto vertex_info = graph_info->GetVertexInfo(label);
auto vertex_info = graph_info->GetVertexInfo(type);
auto maybe_extend_info = vertex_info->AddPropertyGroup(group);
ASSERT(maybe_extend_info.status().ok());
auto extend_info = maybe_extend_info.value();
Expand Down
8 changes: 4 additions & 4 deletions cpp/examples/bfs_push_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ int main(int argc, char* argv[]) {
auto graph_info = graphar::GraphInfo::Load(path).value();

// construct vertices collection
std::string label = "person";
ASSERT(graph_info->GetVertexInfo(label) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, label);
std::string type = "person";
ASSERT(graph_info->GetVertexInfo(type) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, type);
ASSERT(maybe_vertices.status().ok());
auto& vertices = maybe_vertices.value();
int num_vertices = vertices->size();
Expand Down Expand Up @@ -87,7 +87,7 @@ int main(int argc, char* argv[]) {
auto group =
graphar::CreatePropertyGroup(property_vector, graphar::FileType::PARQUET);
// extend the vertex_info
auto vertex_info = graph_info->GetVertexInfo(label);
auto vertex_info = graph_info->GetVertexInfo(type);
auto maybe_extend_info = vertex_info->AddPropertyGroup(group);
ASSERT(maybe_extend_info.status().ok());
auto extend_info = maybe_extend_info.value();
Expand Down
8 changes: 4 additions & 4 deletions cpp/examples/bfs_stream_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ int main(int argc, char* argv[]) {
auto graph_info = graphar::GraphInfo::Load(path).value();

// construct vertices collection
std::string label = "person";
ASSERT(graph_info->GetVertexInfo(label) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, label);
std::string type = "person";
ASSERT(graph_info->GetVertexInfo(type) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, type);
ASSERT(maybe_vertices.status().ok());
auto& vertices = maybe_vertices.value();
int num_vertices = vertices->size();
Expand Down Expand Up @@ -78,7 +78,7 @@ int main(int argc, char* argv[]) {
auto group =
graphar::CreatePropertyGroup(property_vector, graphar::FileType::PARQUET);
// extend the vertex_info
auto vertex_info = graph_info->GetVertexInfo(label);
auto vertex_info = graph_info->GetVertexInfo(type);
auto maybe_extend_info = vertex_info->AddPropertyGroup(group);
ASSERT(maybe_extend_info.status().ok());
auto extend_info = maybe_extend_info.value();
Expand Down
12 changes: 6 additions & 6 deletions cpp/examples/bgl_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ int main(int argc, char* argv[]) {
ASSERT(graph_info->GetEdgeInfos().size() == 1);

// construct vertices collection
std::string label = "person";
ASSERT(graph_info->GetVertexInfo(label) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, label);
std::string type = "person";
ASSERT(graph_info->GetVertexInfo(type) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, type);
ASSERT(maybe_vertices.status().ok());
auto& vertices = maybe_vertices.value();
int num_vertices = vertices->size();
Expand Down Expand Up @@ -108,10 +108,10 @@ int main(int argc, char* argv[]) {
auto group =
graphar::CreatePropertyGroup(property_vector, graphar::FileType::PARQUET);
// construct new vertex info
std::string type = "cc_result", vertex_prefix = "result/";
std::string vertex_type = "cc_result", vertex_prefix = "result/";
int chunk_size = 100;
auto version = graphar::InfoVersion::Parse("gar/v1").value();
auto new_info = graphar::CreateVertexInfo(type, chunk_size, {group},
auto new_info = graphar::CreateVertexInfo(vertex_type, chunk_size, {group},
vertex_prefix, version);
// dump new vertex info
ASSERT(new_info->IsValidated());
Expand All @@ -132,7 +132,7 @@ int main(int argc, char* argv[]) {

// method 2 for writing results: extend the original vertex info and write
// results using writer extend the vertex_info
auto vertex_info = graph_info->GetVertexInfo(label);
auto vertex_info = graph_info->GetVertexInfo(vertex_type);
auto maybe_extend_info = vertex_info->AddPropertyGroup(group);
ASSERT(maybe_extend_info.status().ok());
auto extend_info = maybe_extend_info.value();
Expand Down
8 changes: 4 additions & 4 deletions cpp/examples/cc_push_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ int main(int argc, char* argv[]) {
auto graph_info = graphar::GraphInfo::Load(path).value();

// construct vertices collection
std::string label = "person";
ASSERT(graph_info->GetVertexInfo(label) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, label);
std::string type = "person";
ASSERT(graph_info->GetVertexInfo(type) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, type);
ASSERT(maybe_vertices.status().ok());
auto& vertices = maybe_vertices.value();
int num_vertices = vertices->size();
Expand Down Expand Up @@ -121,7 +121,7 @@ int main(int argc, char* argv[]) {
auto group =
graphar::CreatePropertyGroup(property_vector, graphar::FileType::PARQUET);
// extend the vertex_info
auto vertex_info = graph_info->GetVertexInfo(label);
auto vertex_info = graph_info->GetVertexInfo(type);
auto maybe_extend_info = vertex_info->AddPropertyGroup(group);
ASSERT(maybe_extend_info.status().ok());
auto extend_info = maybe_extend_info.value();
Expand Down
8 changes: 4 additions & 4 deletions cpp/examples/cc_stream_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ int main(int argc, char* argv[]) {
auto graph_info = graphar::GraphInfo::Load(path).value();

// construct vertices collection
std::string label = "person";
ASSERT(graph_info->GetVertexInfo(label) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, label);
std::string type = "person";
ASSERT(graph_info->GetVertexInfo(type) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, type);
ASSERT(maybe_vertices.status().ok());
auto& vertices = maybe_vertices.value();
int num_vertices = vertices->size();
Expand Down Expand Up @@ -89,7 +89,7 @@ int main(int argc, char* argv[]) {
auto group =
graphar::CreatePropertyGroup(property_vector, graphar::FileType::PARQUET);
// extend the vertex_info
auto vertex_info = graph_info->GetVertexInfo(label);
auto vertex_info = graph_info->GetVertexInfo(type);
auto maybe_extend_info = vertex_info->AddPropertyGroup(group);
ASSERT(maybe_extend_info.status().ok());
auto extend_info = maybe_extend_info.value();
Expand Down
4 changes: 2 additions & 2 deletions cpp/examples/high_level_reader_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
void vertices_collection(
const std::shared_ptr<graphar::GraphInfo>& graph_info) {
// construct vertices collection
std::string label = "person", property = "firstName";
std::string type = "person", property = "firstName";
auto maybe_vertices_collection =
graphar::VerticesCollection::Make(graph_info, label);
graphar::VerticesCollection::Make(graph_info, type);
ASSERT(!maybe_vertices_collection.has_error());
auto vertices = maybe_vertices_collection.value();

Expand Down
4 changes: 2 additions & 2 deletions cpp/examples/low_level_reader_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
void vertex_property_chunk_info_reader(
const std::shared_ptr<graphar::GraphInfo>& graph_info) {
// constuct reader
std::string label = "person", property_name = "id";
std::string type = "person", property_name = "id";
auto maybe_reader = graphar::VertexPropertyChunkInfoReader::Make(
graph_info, label, property_name);
graph_info, type, property_name);
ASSERT(!maybe_reader.has_error());
auto reader = maybe_reader.value();

Expand Down
6 changes: 3 additions & 3 deletions cpp/examples/mid_level_reader_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
void vertex_property_chunk_reader(
const std::shared_ptr<graphar::GraphInfo>& graph_info) {
// create reader
std::string label = "person", property_name = "gender";
std::string type = "person", property_name = "gender";
auto maybe_reader = graphar::VertexPropertyArrowChunkReader::Make(
graph_info, label, property_name);
graph_info, type, property_name);
ASSERT(maybe_reader.status().ok());
auto reader = maybe_reader.value();

Expand Down Expand Up @@ -72,7 +72,7 @@ void vertex_property_chunk_reader(
graphar::_Literal("female"));
std::vector<std::string> expected_cols{"firstName", "lastName"};
auto maybe_filter_reader = graphar::VertexPropertyArrowChunkReader::Make(
graph_info, label, property_name);
graph_info, type, property_name);
ASSERT(maybe_filter_reader.status().ok());
auto filter_reader = maybe_filter_reader.value();
filter_reader->Filter(filter);
Expand Down
8 changes: 4 additions & 4 deletions cpp/examples/pagerank_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ int main(int argc, char* argv[]) {
auto graph_info = graphar::GraphInfo::Load(path).value();

// construct vertices collection
std::string label = "person";
ASSERT(graph_info->GetVertexInfo(label) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, label);
std::string type = "person";
ASSERT(graph_info->GetVertexInfo(type) != nullptr);
auto maybe_vertices = graphar::VerticesCollection::Make(graph_info, type);
ASSERT(maybe_vertices.status().ok());
auto& vertices = maybe_vertices.value();
int num_vertices = vertices->size();
Expand Down Expand Up @@ -88,7 +88,7 @@ int main(int argc, char* argv[]) {
auto group =
graphar::CreatePropertyGroup(property_vector, graphar::FileType::PARQUET);
// extend the vertex_info
auto vertex_info = graph_info->GetVertexInfo(label);
auto vertex_info = graph_info->GetVertexInfo(type);
auto maybe_extend_info = vertex_info->AddPropertyGroup(group);
ASSERT(maybe_extend_info.status().ok());
auto extend_info = maybe_extend_info.value();
Expand Down
18 changes: 9 additions & 9 deletions cpp/src/graphar/arrow/chunk_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ VertexPropertyArrowChunkReader::Make(

Result<std::shared_ptr<VertexPropertyArrowChunkReader>>
VertexPropertyArrowChunkReader::Make(
const std::shared_ptr<GraphInfo>& graph_info, const std::string& label,
const std::shared_ptr<GraphInfo>& graph_info, const std::string& type,
const std::shared_ptr<PropertyGroup>& property_group,
const util::FilterOptions& options) {
auto vertex_info = graph_info->GetVertexInfo(label);
auto vertex_info = graph_info->GetVertexInfo(type);
if (!vertex_info) {
return Status::KeyError("The vertex type ", label,
return Status::KeyError("The vertex type ", type,
" doesn't exist in graph ", graph_info->GetName(),
".");
}
Expand All @@ -231,18 +231,18 @@ VertexPropertyArrowChunkReader::Make(

Result<std::shared_ptr<VertexPropertyArrowChunkReader>>
VertexPropertyArrowChunkReader::Make(
const std::shared_ptr<GraphInfo>& graph_info, const std::string& label,
const std::shared_ptr<GraphInfo>& graph_info, const std::string& type,
const std::string& property_name, const util::FilterOptions& options) {
auto vertex_info = graph_info->GetVertexInfo(label);
auto vertex_info = graph_info->GetVertexInfo(type);
if (!vertex_info) {
return Status::KeyError("The vertex type ", label,
return Status::KeyError("The vertex type ", type,
" doesn't exist in graph ", graph_info->GetName(),
".");
}
auto property_group = vertex_info->GetPropertyGroup(property_name);
if (!property_group) {
return Status::KeyError("The property ", property_name,
" doesn't exist in vertex type ", label, ".");
" doesn't exist in vertex type ", type, ".");
}
return Make(vertex_info, property_group, graph_info->GetPrefix(), options);
}
Expand Down Expand Up @@ -361,7 +361,7 @@ Status AdjListArrowChunkReader::seek(IdType offset) {
return Status::IndexError("The edge offset ", offset,
" is out of range [0,",
edge_info_->GetChunkSize() * chunk_num_,
"), edge label: ", edge_info_->GetEdgeType());
"), edge type: ", edge_info_->GetEdgeType());
}
return Status::OK();
}
Expand Down Expand Up @@ -689,7 +689,7 @@ Status AdjListPropertyArrowChunkReader::seek(IdType offset) {
return Status::IndexError("The edge offset ", offset,
" is out of range [0,",
edge_info_->GetChunkSize() * chunk_num_,
"), edge label: ", edge_info_->GetEdgeType());
"), edge type: ", edge_info_->GetEdgeType());
}
return Status::OK();
}
Expand Down
32 changes: 16 additions & 16 deletions cpp/src/graphar/arrow/chunk_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ class VertexPropertyArrowChunkReader {
* property group.
*
* @param graph_info The graph info.
* @param label The vertex label.
* @param type The vertex type.
* @param property_group The property group of the vertex property.
* @param options The filter options, default is empty.
*/
static Result<std::shared_ptr<VertexPropertyArrowChunkReader>> Make(
const std::shared_ptr<GraphInfo>& graph_info, const std::string& label,
const std::shared_ptr<GraphInfo>& graph_info, const std::string& type,
const std::shared_ptr<PropertyGroup>& property_group,
const util::FilterOptions& options = {});

Expand All @@ -128,13 +128,13 @@ class VertexPropertyArrowChunkReader {
* property name.
*
* @param graph_info The graph info.
* @param label The vertex label.
* @param type The vertex type.
* @param property_name The name of one property in the property group you
* want to read.
* @param options The filter options, default is empty.
*/
static Result<std::shared_ptr<VertexPropertyArrowChunkReader>> Make(
const std::shared_ptr<GraphInfo>& graph_info, const std::string& label,
const std::shared_ptr<GraphInfo>& graph_info, const std::string& type,
const std::string& property_name,
const util::FilterOptions& options = {});

Expand Down Expand Up @@ -240,9 +240,9 @@ class AdjListArrowChunkReader {
* @brief Create an AdjListArrowChunkReader instance from graph info.
*
* @param graph_info The graph info.
* @param src_type The source vertex label.
* @param edge_type The edge label.
* @param dst_type The destination vertex label.
* @param src_type The source vertex type.
* @param edge_type The edge type.
* @param dst_type The destination vertex type.
* @param adj_list_type The adj list type for the edges.
*/
static Result<std::shared_ptr<AdjListArrowChunkReader>> Make(
Expand Down Expand Up @@ -326,9 +326,9 @@ class AdjListOffsetArrowChunkReader {
* @brief Create an AdjListOffsetArrowChunkReader instance from graph info.
*
* @param graph_info The graph info.
* @param src_type The source vertex label.
* @param edge_type The edge label.
* @param dst_type The destination vertex label.
* @param src_type The source vertex type.
* @param edge_type The edge type.
* @param dst_type The destination vertex type.
* @param adj_list_type The adj list type for the edges.
*/
static Result<std::shared_ptr<AdjListOffsetArrowChunkReader>> Make(
Expand Down Expand Up @@ -458,9 +458,9 @@ class AdjListPropertyArrowChunkReader {
* and property group.
*
* @param graph_info The graph info that describes the graph.
* @param src_type The source vertex label.
* @param edge_type The edge label.
* @param dst_type The destination vertex label.
* @param src_type The source vertex type.
* @param edge_type The edge type.
* @param dst_type The destination vertex type.
* @param property_group The property group that describes the property
* group.
* @param adj_list_type The adj list type for the edges.
Expand All @@ -477,9 +477,9 @@ class AdjListPropertyArrowChunkReader {
* and property name.
*
* @param graph_info The graph info that describes the graph.
* @param src_type The source vertex label.
* @param edge_type The edge label.
* @param dst_type The destination vertex label.
* @param src_type The source vertex type.
* @param edge_type The edge type.
* @param dst_type The destination vertex type.
* @param property_name The name of one property in the property group you
* want to read.
* @param adj_list_type The adj list type for the edges.
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/graphar/arrow/chunk_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,11 @@ Result<std::shared_ptr<VertexPropertyWriter>> VertexPropertyWriter::Make(
}

Result<std::shared_ptr<VertexPropertyWriter>> VertexPropertyWriter::Make(
const std::shared_ptr<GraphInfo>& graph_info, const std::string& label,
const std::shared_ptr<GraphInfo>& graph_info, const std::string& type,
const ValidateLevel& validate_level) {
auto vertex_info = graph_info->GetVertexInfo(label);
auto vertex_info = graph_info->GetVertexInfo(type);
if (!vertex_info) {
return Status::KeyError("The vertex ", label, " doesn't exist.");
return Status::KeyError("The vertex ", type, " doesn't exist.");
}
return Make(vertex_info, graph_info->GetPrefix(), validate_level);
}
Expand Down
Loading

0 comments on commit c259a37

Please sign in to comment.