Skip to content
Open
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
1 change: 0 additions & 1 deletion cpp/src/graphar/chunk_info_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include <memory>
#include <string>
#include <vector>

#include "graphar/fwd.h"

Expand Down
1 change: 0 additions & 1 deletion cpp/src/graphar/chunk_info_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include <memory>
#include <string>
#include <vector>

#include "graphar/fwd.h"
#include "graphar/writer_util.h"
Expand Down
4 changes: 3 additions & 1 deletion cpp/src/graphar/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ class ExpressionLiteral : public Expression {
ExpressionLiteral(const ExpressionLiteral& other) = default;
~ExpressionLiteral() = default;

Result<ArrowExpression> Evaluate() { return arrow::compute::literal(value_); }
Result<ArrowExpression> Evaluate() override {
return arrow::compute::literal(value_);
}

private:
T value_;
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/graphar/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ enum class FileType : int32_t { CSV = 0, PARQUET = 1, ORC = 2, JSON = 3 };
enum class SelectType : int32_t { PROPERTIES = 0, LABELS = 1 };
/** GetChunkVersion: V1 use scanner, V2 use FileReader */
enum class GetChunkVersion : int32_t { AUTO = 0, V1 = 1, V2 = 2 };
enum class AdjListType : int32_t;
enum class AdjListType;

template <typename T>
class Array;
Expand Down
36 changes: 23 additions & 13 deletions cpp/src/graphar/high-level/graph_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,10 @@ class VerticesCollection {

/** The iterator pointing to the past-the-end element. */
VertexIter end() noexcept {
if (is_filtered_)
if (is_filtered_) {
return VertexIter(vertex_info_, prefix_, filtered_ids_.size(), labels_,
is_filtered_, filtered_ids_);
}
return VertexIter(vertex_info_, prefix_, vertex_num_, labels_, is_filtered_,
filtered_ids_);
}
Expand All @@ -369,10 +370,11 @@ class VerticesCollection {

/** Get the number of vertices in the collection. */
size_t size() const noexcept {
if (is_filtered_)
if (is_filtered_) {
return filtered_ids_.size();
else
} else {
return vertex_num_;
}
}

std::shared_ptr<VertexInfo> GetVertexInfo() const { return vertex_info_; }
Expand Down Expand Up @@ -718,25 +720,28 @@ class EdgeIter {

/** Point to the next edge with the same source, return false if not found. */
bool next_src() {
if (is_end())
if (is_end()) {
return false;
}
IdType id = this->source();
IdType pre_vertex_chunk_index = vertex_chunk_index_;
if (adj_list_type_ == AdjListType::ordered_by_source) {
this->operator++();
if (is_end() || this->source() != id)
if (is_end() || this->source() != id) {
return false;
else
} else {
return true;
}
}
this->operator++();
while (!is_end()) {
if (this->source() == id) {
return true;
}
if (adj_list_type_ == AdjListType::unordered_by_source) {
if (vertex_chunk_index_ > pre_vertex_chunk_index)
if (vertex_chunk_index_ > pre_vertex_chunk_index) {
return false;
}
}
this->operator++();
}
Expand All @@ -748,25 +753,28 @@ class EdgeIter {
* found.
*/
bool next_dst() {
if (is_end())
if (is_end()) {
return false;
}
IdType id = this->destination();
IdType pre_vertex_chunk_index = vertex_chunk_index_;
if (adj_list_type_ == AdjListType::ordered_by_dest) {
this->operator++();
if (is_end() || this->destination() != id)
if (is_end() || this->destination() != id) {
return false;
else
} else {
return true;
}
}
this->operator++();
while (!is_end()) {
if (this->destination() == id) {
return true;
}
if (adj_list_type_ == AdjListType::unordered_by_dest) {
if (vertex_chunk_index_ > pre_vertex_chunk_index)
if (vertex_chunk_index_ > pre_vertex_chunk_index) {
return false;
}
}
this->operator++();
}
Expand All @@ -778,8 +786,9 @@ class EdgeIter {
* found.
*/
bool next_src(IdType id) {
if (is_end())
if (is_end()) {
return false;
}
this->operator++();
return this->first_src(*this, id);
}
Expand All @@ -789,8 +798,9 @@ class EdgeIter {
* not found.
*/
bool next_dst(IdType id) {
if (is_end())
if (is_end()) {
return false;
}
this->operator++();
return this->first_dst(*this, id);
}
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/graphar/high-level/vertices_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,9 @@ class VerticesBuilder {
vertices_.push_back(v);
} else {
v.SetId(index);
if (index >= static_cast<IdType>(vertices_.size()))
if (index >= static_cast<IdType>(vertices_.size())) {
vertices_.resize(index + 1);
}
vertices_[index] = v;
}
num_vertices_++;
Expand Down
2 changes: 0 additions & 2 deletions cpp/src/graphar/label.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#include <parquet/api/writer.h>
#include <parquet/properties.h>

#include <iostream>
#include <set>
#include <vector>

using parquet::ConvertedType;
Expand Down
2 changes: 0 additions & 2 deletions cpp/src/graphar/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

#pragma once

#include <cstdint>

// namespace config

#define GAR_EXPAND(x) x
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/graphar/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class Date {
};

/** Adj list type enumeration for adjacency list of graph. */
enum class AdjListType : std::int32_t {
enum class AdjListType : int32_t {
/// collection of edges by source, but unordered, can represent COO format
unordered_by_source = 0b00000001,
/// collection of edges by destination, but unordered, can represent COO
Expand Down
Loading