diff --git a/cpp/include/gar/graph.h b/cpp/include/gar/graph.h index c55b5acd2..68b021e45 100644 --- a/cpp/include/gar/graph.h +++ b/cpp/include/gar/graph.h @@ -26,8 +26,8 @@ limitations under the License. #include #include "gar/reader/arrow_chunk_reader.h" -#include "gar/utils/reader_utils.h" -#include "gar/utils/utils.h" +#include "gar/util/reader_util.h" +#include "gar/util/util.h" // forward declarations namespace arrow { @@ -651,7 +651,7 @@ class EdgesCollection { : edge_info_(edge_info), prefix_(prefix) { GAR_ASSIGN_OR_RAISE_ERROR( auto vertex_chunk_num, - utils::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); + util::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); std::vector edge_chunk_nums(vertex_chunk_num, 0); if (vertex_chunk_end == std::numeric_limits::max()) { vertex_chunk_end = vertex_chunk_num; @@ -662,7 +662,7 @@ class EdgesCollection { for (IdType i = 0; i < vertex_chunk_num; ++i) { GAR_ASSIGN_OR_RAISE_ERROR( edge_chunk_nums[i], - utils::GetEdgeChunkNum(prefix, edge_info, adj_list_type_, i)); + util::GetEdgeChunkNum(prefix, edge_info, adj_list_type_, i)); if (i < vertex_chunk_begin) { chunk_begin_ += edge_chunk_nums[i]; chunk_end_ += edge_chunk_nums[i]; @@ -671,7 +671,7 @@ class EdgesCollection { chunk_end_ += edge_chunk_nums[i]; GAR_ASSIGN_OR_RAISE_ERROR( auto chunk_edge_num_, - utils::GetEdgeNum(prefix, edge_info, adj_list_type_, i)); + util::GetEdgeNum(prefix, edge_info, adj_list_type_, i)); edge_num_ += chunk_edge_num_; } } @@ -708,8 +708,8 @@ class EdgesCollection { * @return The new constructed iterator. */ EdgeIter find_src(IdType id, const EdgeIter& from) { - auto result = utils::GetAdjListOffsetOfVertex(edge_info_, prefix_, - adj_list_type_, id); + auto result = + util::GetAdjListOffsetOfVertex(edge_info_, prefix_, adj_list_type_, id); if (!result.status().ok()) { return this->end(); } @@ -804,7 +804,7 @@ class EdgesCollection { : edge_info_(edge_info), prefix_(prefix) { GAR_ASSIGN_OR_RAISE_ERROR( auto vertex_chunk_num, - utils::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); + util::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); std::vector edge_chunk_nums(vertex_chunk_num, 0); if (vertex_chunk_end == std::numeric_limits::max()) { vertex_chunk_end = vertex_chunk_num; @@ -815,7 +815,7 @@ class EdgesCollection { for (IdType i = 0; i < vertex_chunk_num; ++i) { GAR_ASSIGN_OR_RAISE_ERROR( edge_chunk_nums[i], - utils::GetEdgeChunkNum(prefix, edge_info, adj_list_type_, i)); + util::GetEdgeChunkNum(prefix, edge_info, adj_list_type_, i)); if (i < vertex_chunk_begin) { chunk_begin_ += edge_chunk_nums[i]; chunk_end_ += edge_chunk_nums[i]; @@ -824,7 +824,7 @@ class EdgesCollection { chunk_end_ += edge_chunk_nums[i]; GAR_ASSIGN_OR_RAISE_ERROR( auto chunk_edge_num_, - utils::GetEdgeNum(prefix, edge_info, adj_list_type_, i)); + util::GetEdgeNum(prefix, edge_info, adj_list_type_, i)); edge_num_ += chunk_edge_num_; } } @@ -882,8 +882,8 @@ class EdgesCollection { * @return The new constructed iterator. */ EdgeIter find_dst(IdType id, const EdgeIter& from) { - auto result = utils::GetAdjListOffsetOfVertex(edge_info_, prefix_, - adj_list_type_, id); + auto result = + util::GetAdjListOffsetOfVertex(edge_info_, prefix_, adj_list_type_, id); if (!result.status().ok()) { return this->end(); } @@ -957,7 +957,7 @@ class EdgesCollection { : edge_info_(edge_info), prefix_(prefix) { GAR_ASSIGN_OR_RAISE_ERROR( auto vertex_chunk_num, - utils::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); + util::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); std::vector edge_chunk_nums(vertex_chunk_num, 0); if (vertex_chunk_end == std::numeric_limits::max()) { vertex_chunk_end = vertex_chunk_num; @@ -968,7 +968,7 @@ class EdgesCollection { for (IdType i = 0; i < vertex_chunk_num; ++i) { GAR_ASSIGN_OR_RAISE_ERROR( edge_chunk_nums[i], - utils::GetEdgeChunkNum(prefix, edge_info, adj_list_type_, i)); + util::GetEdgeChunkNum(prefix, edge_info, adj_list_type_, i)); if (i < vertex_chunk_begin) { chunk_begin_ += edge_chunk_nums[i]; chunk_end_ += edge_chunk_nums[i]; @@ -977,7 +977,7 @@ class EdgesCollection { chunk_end_ += edge_chunk_nums[i]; GAR_ASSIGN_OR_RAISE_ERROR( auto chunk_edge_num_, - utils::GetEdgeNum(prefix, edge_info, adj_list_type_, i)); + util::GetEdgeNum(prefix, edge_info, adj_list_type_, i)); edge_num_ += chunk_edge_num_; } } @@ -1083,7 +1083,7 @@ class EdgesCollection { : edge_info_(edge_info), prefix_(prefix) { GAR_ASSIGN_OR_RAISE_ERROR( auto vertex_chunk_num, - utils::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); + util::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); std::vector edge_chunk_nums(vertex_chunk_num, 0); if (vertex_chunk_end == std::numeric_limits::max()) { vertex_chunk_end = vertex_chunk_num; @@ -1094,7 +1094,7 @@ class EdgesCollection { for (IdType i = 0; i < vertex_chunk_num; ++i) { GAR_ASSIGN_OR_RAISE_ERROR( edge_chunk_nums[i], - utils::GetEdgeChunkNum(prefix, edge_info, adj_list_type_, i)); + util::GetEdgeChunkNum(prefix, edge_info, adj_list_type_, i)); if (i < vertex_chunk_begin) { chunk_begin_ += edge_chunk_nums[i]; chunk_end_ += edge_chunk_nums[i]; @@ -1103,7 +1103,7 @@ class EdgesCollection { chunk_end_ += edge_chunk_nums[i]; GAR_ASSIGN_OR_RAISE_ERROR( auto chunk_edge_num_, - utils::GetEdgeNum(prefix, edge_info, adj_list_type_, i)); + util::GetEdgeNum(prefix, edge_info, adj_list_type_, i)); edge_num_ += chunk_edge_num_; } } diff --git a/cpp/include/gar/graph_info.h b/cpp/include/gar/graph_info.h index 370a1138f..81b2452fb 100644 --- a/cpp/include/gar/graph_info.h +++ b/cpp/include/gar/graph_info.h @@ -22,14 +22,14 @@ limitations under the License. #include #include -#include "utils/adj_list_type.h" -#include "utils/data_type.h" -#include "utils/file_type.h" -#include "utils/result.h" -#include "utils/status.h" -#include "utils/utils.h" -#include "utils/version_parser.h" -#include "utils/yaml.h" +#include "util/adj_list_type.h" +#include "util/data_type.h" +#include "util/file_type.h" +#include "util/result.h" +#include "util/status.h" +#include "util/util.h" +#include "util/version_parser.h" +#include "util/yaml.h" namespace GAR_NAMESPACE_INTERNAL { diff --git a/cpp/include/gar/reader/arrow_chunk_reader.h b/cpp/include/gar/reader/arrow_chunk_reader.h index e350d9376..f221b21ba 100644 --- a/cpp/include/gar/reader/arrow_chunk_reader.h +++ b/cpp/include/gar/reader/arrow_chunk_reader.h @@ -22,11 +22,11 @@ limitations under the License. #include #include "gar/graph_info.h" -#include "gar/utils/data_type.h" -#include "gar/utils/filesystem.h" -#include "gar/utils/result.h" -#include "gar/utils/status.h" -#include "gar/utils/utils.h" +#include "gar/util/data_type.h" +#include "gar/util/filesystem.h" +#include "gar/util/result.h" +#include "gar/util/status.h" +#include "gar/util/util.h" // forward declaration namespace arrow { @@ -52,7 +52,7 @@ class VertexPropertyArrowChunkReader { const PropertyGroup& property_group, const std::string& prefix, IdType chunk_index = 0, - const utils::FilterOptions& options = {}) + const util::FilterOptions& options = {}) : vertex_info_(vertex_info), property_group_(property_group), chunk_index_(chunk_index), @@ -64,9 +64,9 @@ class VertexPropertyArrowChunkReader { vertex_info.GetPathPrefix(property_group)); std::string base_dir = prefix_ + pg_path_prefix; GAR_ASSIGN_OR_RAISE_ERROR(chunk_num_, - utils::GetVertexChunkNum(prefix_, vertex_info)); + util::GetVertexChunkNum(prefix_, vertex_info)); GAR_ASSIGN_OR_RAISE_ERROR(vertex_num_, - utils::GetVertexNum(prefix_, vertex_info_)); + util::GetVertexNum(prefix_, vertex_info_)); } /** @@ -135,7 +135,7 @@ class VertexPropertyArrowChunkReader { * * @param filter Predicate expression to filter rows. */ - void Filter(utils::Filter filter = nullptr); + void Filter(util::Filter filter = nullptr); /** * @brief Apply the projection to the table to be read. No parameter call @@ -143,7 +143,7 @@ class VertexPropertyArrowChunkReader { * * @param column_names The name of columns to be selected. */ - void Select(utils::ColumnNames column_names = std::nullopt); + void Select(util::ColumnNames column_names = std::nullopt); private: VertexInfo vertex_info_; @@ -154,7 +154,7 @@ class VertexPropertyArrowChunkReader { IdType chunk_num_; IdType vertex_num_; std::shared_ptr chunk_table_; - utils::FilterOptions filter_options_; + util::FilterOptions filter_options_; std::shared_ptr fs_; }; @@ -188,10 +188,10 @@ class AdjListArrowChunkReader { base_dir_ = prefix_ + adj_list_path_prefix; GAR_ASSIGN_OR_RAISE_ERROR( vertex_chunk_num_, - utils::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); + util::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); GAR_ASSIGN_OR_RAISE_ERROR( - chunk_num_, utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); } /** @@ -276,9 +276,8 @@ class AdjListArrowChunkReader { } chunk_index_ = 0; GAR_ASSIGN_OR_RAISE_ERROR( - chunk_num_, - utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); } seek_offset_ = chunk_index_ * edge_info_.GetChunkSize(); chunk_table_.reset(); @@ -296,9 +295,8 @@ class AdjListArrowChunkReader { if (vertex_chunk_index_ != vertex_chunk_index) { vertex_chunk_index_ = vertex_chunk_index; GAR_ASSIGN_OR_RAISE_ERROR( - chunk_num_, - utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); chunk_table_.reset(); } if (chunk_index_ != chunk_index) { @@ -353,7 +351,7 @@ class AdjListOffsetArrowChunkReader { adj_list_type == AdjListType::ordered_by_dest) { GAR_ASSIGN_OR_RAISE_ERROR( vertex_chunk_num_, - utils::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); + util::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); vertex_chunk_size_ = adj_list_type == AdjListType::ordered_by_source ? edge_info_.GetSrcChunkSize() : edge_info_.GetDstChunkSize(); @@ -453,7 +451,7 @@ class AdjListPropertyArrowChunkReader { AdjListType adj_list_type, const std::string prefix, IdType vertex_chunk_index = 0, - const utils::FilterOptions& options = {}) + const util::FilterOptions& options = {}) : edge_info_(edge_info), property_group_(property_group), adj_list_type_(adj_list_type), @@ -470,10 +468,10 @@ class AdjListPropertyArrowChunkReader { base_dir_ = prefix_ + pg_path_prefix; GAR_ASSIGN_OR_RAISE_ERROR( vertex_chunk_num_, - utils::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); + util::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); GAR_ASSIGN_OR_RAISE_ERROR( - chunk_num_, utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); } /** @@ -558,9 +556,8 @@ class AdjListPropertyArrowChunkReader { } chunk_index_ = 0; GAR_ASSIGN_OR_RAISE_ERROR( - chunk_num_, - utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); } seek_offset_ = chunk_index_ * edge_info_.GetChunkSize(); chunk_table_.reset(); @@ -578,9 +575,8 @@ class AdjListPropertyArrowChunkReader { if (vertex_chunk_index_ != vertex_chunk_index) { vertex_chunk_index_ = vertex_chunk_index; GAR_ASSIGN_OR_RAISE_ERROR( - chunk_num_, - utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); chunk_table_.reset(); } if (chunk_index_ != chunk_index) { @@ -597,7 +593,7 @@ class AdjListPropertyArrowChunkReader { * * @param filter Predicate expression to filter rows. */ - void Filter(utils::Filter filter = nullptr); + void Filter(util::Filter filter = nullptr); /** * @brief Apply the projection to the table to be read. No parameter call @@ -605,7 +601,7 @@ class AdjListPropertyArrowChunkReader { * * @param column_names The name of columns to be selected. */ - void Select(utils::ColumnNames column_names = std::nullopt); + void Select(util::ColumnNames column_names = std::nullopt); private: EdgeInfo edge_info_; @@ -615,7 +611,7 @@ class AdjListPropertyArrowChunkReader { IdType vertex_chunk_index_, chunk_index_; IdType seek_offset_; std::shared_ptr chunk_table_; - utils::FilterOptions filter_options_; + util::FilterOptions filter_options_; IdType vertex_chunk_num_, chunk_num_; std::string base_dir_; std::shared_ptr fs_; @@ -632,7 +628,7 @@ static inline Result ConstructVertexPropertyArrowChunkReader( const GraphInfo& graph_info, const std::string& label, const PropertyGroup& property_group, - const utils::FilterOptions& options = {}) noexcept { + const util::FilterOptions& options = {}) noexcept { VertexInfo vertex_info; GAR_ASSIGN_OR_RAISE(vertex_info, graph_info.GetVertexInfo(label)); if (!vertex_info.ContainPropertyGroup(property_group)) { @@ -712,7 +708,7 @@ ConstructAdjListPropertyArrowChunkReader( const GraphInfo& graph_info, const std::string& src_label, const std::string& edge_label, const std::string& dst_label, const PropertyGroup& property_group, AdjListType adj_list_type, - const utils::FilterOptions& options = {}) noexcept { + const util::FilterOptions& options = {}) noexcept { EdgeInfo edge_info; GAR_ASSIGN_OR_RAISE(edge_info, graph_info.GetEdgeInfo(src_label, edge_label, dst_label)); diff --git a/cpp/include/gar/reader/chunk_info_reader.h b/cpp/include/gar/reader/chunk_info_reader.h index d7ce2f8fc..f5f8a11e2 100644 --- a/cpp/include/gar/reader/chunk_info_reader.h +++ b/cpp/include/gar/reader/chunk_info_reader.h @@ -21,12 +21,12 @@ limitations under the License. #include #include "gar/graph_info.h" -#include "gar/utils/data_type.h" -#include "gar/utils/filesystem.h" -#include "gar/utils/reader_utils.h" -#include "gar/utils/result.h" -#include "gar/utils/status.h" -#include "gar/utils/utils.h" +#include "gar/util/data_type.h" +#include "gar/util/filesystem.h" +#include "gar/util/reader_util.h" +#include "gar/util/result.h" +#include "gar/util/status.h" +#include "gar/util/util.h" namespace GAR_NAMESPACE_INTERNAL { @@ -57,7 +57,7 @@ class VertexPropertyChunkInfoReader { vertex_info.GetPathPrefix(property_group)); base_dir += pg_path_prefix; GAR_ASSIGN_OR_RAISE_ERROR(chunk_num_, - utils::GetVertexChunkNum(prefix_, vertex_info_)); + util::GetVertexChunkNum(prefix_, vertex_info_)); } /** @@ -141,10 +141,10 @@ class AdjListChunkInfoReader { base_dir_ = prefix_ + adj_list_path_prefix; GAR_ASSIGN_OR_RAISE_ERROR( vertex_chunk_num_, - utils::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); + util::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); GAR_ASSIGN_OR_RAISE_ERROR( - chunk_num_, utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); } /** @@ -206,9 +206,8 @@ class AdjListChunkInfoReader { } chunk_index_ = 0; GAR_ASSIGN_OR_RAISE_ERROR( - chunk_num_, - utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); } return Status::OK(); } @@ -253,10 +252,10 @@ class AdjListPropertyChunkInfoReader { base_dir_ = prefix_ + pg_path_prefix; GAR_ASSIGN_OR_RAISE_ERROR( vertex_chunk_num_, - utils::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); + util::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_)); GAR_ASSIGN_OR_RAISE_ERROR( - chunk_num_, utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); } /** @@ -320,9 +319,8 @@ class AdjListPropertyChunkInfoReader { } chunk_index_ = 0; GAR_ASSIGN_OR_RAISE_ERROR( - chunk_num_, - utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); } return Status::OK(); } diff --git a/cpp/include/gar/utils/adj_list_type.h b/cpp/include/gar/util/adj_list_type.h similarity index 95% rename from cpp/include/gar/utils/adj_list_type.h rename to cpp/include/gar/util/adj_list_type.h index c77801236..0a9c79b90 100644 --- a/cpp/include/gar/utils/adj_list_type.h +++ b/cpp/include/gar/util/adj_list_type.h @@ -17,10 +17,10 @@ limitations under the License. #include #include -#include "gar/utils/macros.h" +#include "gar/util/macros.h" -#ifndef GAR_UTILS_ADJ_LIST_TYPE_H_ -#define GAR_UTILS_ADJ_LIST_TYPE_H_ +#ifndef GAR_UTIL_ADJ_LIST_TYPE_H_ +#define GAR_UTIL_ADJ_LIST_TYPE_H_ namespace GAR_NAMESPACE_INTERNAL { @@ -86,4 +86,4 @@ static inline std::pair AdjListTypeToOrderedAligned( } } // namespace GAR_NAMESPACE_INTERNAL -#endif // GAR_UTILS_ADJ_LIST_TYPE_H_ +#endif // GAR_UTIL_ADJ_LIST_TYPE_H_ diff --git a/cpp/include/gar/utils/convert_to_arrow_type.h b/cpp/include/gar/util/convert_to_arrow_type.h similarity index 94% rename from cpp/include/gar/utils/convert_to_arrow_type.h rename to cpp/include/gar/util/convert_to_arrow_type.h index ea3b72c9d..3c69e0e8b 100644 --- a/cpp/include/gar/utils/convert_to_arrow_type.h +++ b/cpp/include/gar/util/convert_to_arrow_type.h @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -#ifndef GAR_UTILS_CONVERT_TO_ARROW_TYPE_H_ -#define GAR_UTILS_CONVERT_TO_ARROW_TYPE_H_ +#ifndef GAR_UTIL_CONVERT_TO_ARROW_TYPE_H_ +#define GAR_UTIL_CONVERT_TO_ARROW_TYPE_H_ #include #include @@ -22,7 +22,7 @@ limitations under the License. #include "arrow/api.h" #include "arrow/type.h" -#include "gar/utils/data_type.h" +#include "gar/util/data_type.h" namespace GAR_NAMESPACE_INTERNAL { @@ -59,4 +59,4 @@ CONVERT_TO_ARROW_TYPE(Type::STRING, std::string, arrow::LargeStringType, } // namespace GAR_NAMESPACE_INTERNAL -#endif // GAR_UTILS_CONVERT_TO_ARROW_TYPE_H_ +#endif // GAR_UTIL_CONVERT_TO_ARROW_TYPE_H_ diff --git a/cpp/include/gar/utils/data_type.h b/cpp/include/gar/util/data_type.h similarity index 95% rename from cpp/include/gar/utils/data_type.h rename to cpp/include/gar/util/data_type.h index 2612ba2dd..65534b8c1 100644 --- a/cpp/include/gar/utils/data_type.h +++ b/cpp/include/gar/util/data_type.h @@ -13,15 +13,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -#ifndef GAR_UTILS_DATA_TYPE_H_ -#define GAR_UTILS_DATA_TYPE_H_ +#ifndef GAR_UTIL_DATA_TYPE_H_ +#define GAR_UTIL_DATA_TYPE_H_ #include #include #include #include -#include "gar/utils/macros.h" +#include "gar/util/macros.h" // forward declaration namespace arrow { @@ -116,4 +116,4 @@ class DataType { }; // struct DataType } // namespace GAR_NAMESPACE_INTERNAL -#endif // GAR_UTILS_DATA_TYPE_H_ +#endif // GAR_UTIL_DATA_TYPE_H_ diff --git a/cpp/include/gar/utils/expression.h b/cpp/include/gar/util/expression.h similarity index 99% rename from cpp/include/gar/utils/expression.h rename to cpp/include/gar/util/expression.h index cc53505fc..afd86e6c2 100644 --- a/cpp/include/gar/utils/expression.h +++ b/cpp/include/gar/util/expression.h @@ -20,8 +20,8 @@ limitations under the License. #include "gar/graph_info.h" -#ifndef GAR_UTILS_EXPRESSION_H_ -#define GAR_UTILS_EXPRESSION_H_ +#ifndef GAR_UTIL_EXPRESSION_H_ +#define GAR_UTIL_EXPRESSION_H_ namespace GAR_NAMESPACE_INTERNAL { @@ -353,4 +353,4 @@ template (lhs, rhs); } } // namespace GAR_NAMESPACE_INTERNAL -#endif // GAR_UTILS_EXPRESSION_H_ +#endif // GAR_UTIL_EXPRESSION_H_ diff --git a/cpp/include/gar/utils/file_type.h b/cpp/include/gar/util/file_type.h similarity index 91% rename from cpp/include/gar/utils/file_type.h rename to cpp/include/gar/util/file_type.h index 471d9cc72..4e8d4da16 100644 --- a/cpp/include/gar/utils/file_type.h +++ b/cpp/include/gar/util/file_type.h @@ -17,10 +17,10 @@ limitations under the License. #include #include -#include "gar/utils/macros.h" +#include "gar/util/macros.h" -#ifndef GAR_UTILS_FILE_TYPE_H_ -#define GAR_UTILS_FILE_TYPE_H_ +#ifndef GAR_UTIL_FILE_TYPE_H_ +#define GAR_UTIL_FILE_TYPE_H_ namespace GAR_NAMESPACE_INTERNAL { @@ -48,4 +48,4 @@ static inline const char* FileTypeToString(FileType file_type) { } } // namespace GAR_NAMESPACE_INTERNAL -#endif // GAR_UTILS_FILE_TYPE_H_ +#endif // GAR_UTIL_FILE_TYPE_H_ diff --git a/cpp/include/gar/utils/filesystem.h b/cpp/include/gar/util/filesystem.h similarity index 93% rename from cpp/include/gar/utils/filesystem.h rename to cpp/include/gar/util/filesystem.h index 34afccd6c..364ef11cd 100644 --- a/cpp/include/gar/utils/filesystem.h +++ b/cpp/include/gar/util/filesystem.h @@ -13,21 +13,21 @@ See the License for the specific language governing permissions and limitations under the License. */ -#ifndef GAR_UTILS_FILESYSTEM_H_ -#define GAR_UTILS_FILESYSTEM_H_ +#ifndef GAR_UTIL_FILESYSTEM_H_ +#define GAR_UTIL_FILESYSTEM_H_ #include #include #include #include -#include "gar/utils/file_type.h" -#include "gar/utils/result.h" -#include "gar/utils/status.h" -#include "gar/utils/utils.h" +#include "gar/util/file_type.h" +#include "gar/util/result.h" +#include "gar/util/status.h" +#include "gar/util/util.h" #include "arrow/dataset/api.h" -#include "gar/utils/reader_utils.h" +#include "gar/util/reader_util.h" // forward declarations namespace arrow { @@ -70,7 +70,7 @@ class FileSystem { */ Result> ReadFileToTable( const std::string& path, FileType file_type, - const utils::FilterOptions& options = {}) const noexcept; + const util::FilterOptions& options = {}) const noexcept; /** * @brief Read a file and convert its bytes to a value of type T. @@ -146,4 +146,4 @@ Result> FileSystemFromUriOrPath( const std::string& uri, std::string* out_path = nullptr); } // namespace GAR_NAMESPACE_INTERNAL -#endif // GAR_UTILS_FILESYSTEM_H_ +#endif // GAR_UTIL_FILESYSTEM_H_ diff --git a/cpp/include/gar/utils/general_params.h b/cpp/include/gar/util/general_params.h similarity index 90% rename from cpp/include/gar/utils/general_params.h rename to cpp/include/gar/util/general_params.h index d0e05b3e7..2aa968f72 100644 --- a/cpp/include/gar/utils/general_params.h +++ b/cpp/include/gar/util/general_params.h @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -#ifndef GAR_UTILS_GENERAL_PARAMS_H_ -#define GAR_UTILS_GENERAL_PARAMS_H_ +#ifndef GAR_UTIL_GENERAL_PARAMS_H_ +#define GAR_UTIL_GENERAL_PARAMS_H_ namespace GAR_NAMESPACE_INTERNAL { @@ -28,4 +28,4 @@ struct GeneralParams { } // namespace GAR_NAMESPACE_INTERNAL -#endif // GAR_UTILS_GENERAL_PARAMS_H_ +#endif // GAR_UTIL_GENERAL_PARAMS_H_ diff --git a/cpp/include/gar/utils/macros.h b/cpp/include/gar/util/macros.h similarity index 94% rename from cpp/include/gar/utils/macros.h rename to cpp/include/gar/util/macros.h index 6128f4df7..c35b5a144 100644 --- a/cpp/include/gar/utils/macros.h +++ b/cpp/include/gar/util/macros.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef GAR_UTILS_MACROS_H_ -#define GAR_UTILS_MACROS_H_ +#ifndef GAR_UTIL_MACROS_H_ +#define GAR_UTIL_MACROS_H_ #include @@ -46,4 +46,4 @@ #define GAR_PREDICT_TRUE(x) (x) #endif -#endif // GAR_UTILS_MACROS_H_ +#endif // GAR_UTIL_MACROS_H_ diff --git a/cpp/include/gar/utils/reader_utils.h b/cpp/include/gar/util/reader_util.h similarity index 93% rename from cpp/include/gar/utils/reader_utils.h rename to cpp/include/gar/util/reader_util.h index 88d80e17a..ce0ef5b5a 100644 --- a/cpp/include/gar/utils/reader_utils.h +++ b/cpp/include/gar/util/reader_util.h @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -#ifndef GAR_UTILS_READER_UTILS_H_ -#define GAR_UTILS_READER_UTILS_H_ +#ifndef GAR_UTIL_READER_UTIL_H_ +#define GAR_UTIL_READER_UTIL_H_ #include #include @@ -22,11 +22,11 @@ limitations under the License. #include #include "gar/graph_info.h" -#include "gar/utils/expression.h" +#include "gar/util/expression.h" namespace GAR_NAMESPACE_INTERNAL { -namespace utils { +namespace util { using Filter = std::shared_ptr; using ColumnNames = @@ -73,6 +73,6 @@ Result GetEdgeNum(const std::string& prefix, const EdgeInfo& edge_info, AdjListType adj_list_type, IdType vertex_chunk_index) noexcept; -} // namespace utils +} // namespace util } // namespace GAR_NAMESPACE_INTERNAL -#endif // GAR_UTILS_READER_UTILS_H_ +#endif // GAR_UTIL_READER_UTIL_H_ diff --git a/cpp/include/gar/utils/result.h b/cpp/include/gar/util/result.h similarity index 97% rename from cpp/include/gar/utils/result.h rename to cpp/include/gar/util/result.h index 37efe0ff2..0bdc40c29 100644 --- a/cpp/include/gar/utils/result.h +++ b/cpp/include/gar/util/result.h @@ -13,14 +13,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -#ifndef GAR_UTILS_RESULT_H_ -#define GAR_UTILS_RESULT_H_ +#ifndef GAR_UTIL_RESULT_H_ +#define GAR_UTIL_RESULT_H_ #include #include "gar/external/result.hpp" -#include "gar/utils/status.h" +#include "gar/util/status.h" #define GAR_ASSIGN_OR_RAISE_IMPL(result_name, lhs, rexpr) \ auto&& result_name = (rexpr); \ @@ -149,4 +149,4 @@ inline Status GenericToStatus(Result&& res) { } // namespace internal } // namespace GAR_NAMESPACE_INTERNAL -#endif // GAR_UTILS_RESULT_H_ +#endif // GAR_UTIL_RESULT_H_ diff --git a/cpp/include/gar/utils/status.h b/cpp/include/gar/util/status.h similarity index 98% rename from cpp/include/gar/utils/status.h rename to cpp/include/gar/util/status.h index 975c30910..78274d81c 100644 --- a/cpp/include/gar/utils/status.h +++ b/cpp/include/gar/util/status.h @@ -13,14 +13,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -#ifndef GAR_UTILS_STATUS_H_ -#define GAR_UTILS_STATUS_H_ +#ifndef GAR_UTIL_STATUS_H_ +#define GAR_UTIL_STATUS_H_ #include #include #include -#include "gar/utils/macros.h" +#include "gar/util/macros.h" #define GAR_RETURN_IF_(condition, status, _) \ do { \ @@ -279,4 +279,4 @@ inline Status GenericToStatus(Status&& st) { return std::move(st); } } // namespace GAR_NAMESPACE_INTERNAL -#endif // GAR_UTILS_STATUS_H_ +#endif // GAR_UTIL_STATUS_H_ diff --git a/cpp/include/gar/utils/utils.h b/cpp/include/gar/util/util.h similarity index 97% rename from cpp/include/gar/utils/utils.h rename to cpp/include/gar/util/util.h index 096eac37d..391788589 100644 --- a/cpp/include/gar/utils/utils.h +++ b/cpp/include/gar/util/util.h @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -#ifndef GAR_UTILS_UTILS_H_ -#define GAR_UTILS_UTILS_H_ +#ifndef GAR_UTIL_UTIL_H_ +#define GAR_UTIL_UTIL_H_ #include #include @@ -22,7 +22,7 @@ limitations under the License. #include #include -#include "gar/utils/result.h" +#include "gar/util/result.h" #define REGULAR_SEPERATOR "_" @@ -129,4 +129,4 @@ struct ValueGetter { } // namespace util } // namespace GAR_NAMESPACE_INTERNAL -#endif // GAR_UTILS_UTILS_H_ +#endif // GAR_UTIL_UTIL_H_ diff --git a/cpp/include/gar/utils/version_parser.h b/cpp/include/gar/util/version_parser.h similarity index 96% rename from cpp/include/gar/utils/version_parser.h rename to cpp/include/gar/util/version_parser.h index 1e01c9354..e8246953c 100644 --- a/cpp/include/gar/utils/version_parser.h +++ b/cpp/include/gar/util/version_parser.h @@ -13,15 +13,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -#ifndef GAR_UTILS_VERSION_PARSER_H_ -#define GAR_UTILS_VERSION_PARSER_H_ +#ifndef GAR_UTIL_VERSION_PARSER_H_ +#define GAR_UTIL_VERSION_PARSER_H_ #include #include // NOLINT #include #include -#include "gar/utils/result.h" +#include "gar/util/result.h" namespace GAR_NAMESPACE_INTERNAL { @@ -105,4 +105,4 @@ class InfoVersion { }; } // namespace GAR_NAMESPACE_INTERNAL -#endif // GAR_UTILS_VERSION_PARSER_H_ +#endif // GAR_UTIL_VERSION_PARSER_H_ diff --git a/cpp/include/gar/utils/writer_utils.h b/cpp/include/gar/util/writer_util.h similarity index 90% rename from cpp/include/gar/utils/writer_utils.h rename to cpp/include/gar/util/writer_util.h index c431eb75a..126a7365f 100644 --- a/cpp/include/gar/utils/writer_utils.h +++ b/cpp/include/gar/util/writer_util.h @@ -13,10 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -#ifndef GAR_UTILS_WRITER_UTILS_H_ -#define GAR_UTILS_WRITER_UTILS_H_ +#ifndef GAR_UTIL_WRITER_UTIL_H_ +#define GAR_UTIL_WRITER_UTIL_H_ -#include "gar/utils/macros.h" +#include "gar/util/macros.h" namespace GAR_NAMESPACE_INTERNAL { @@ -38,4 +38,4 @@ enum class ValidateLevel : char { }; } // namespace GAR_NAMESPACE_INTERNAL -#endif // GAR_UTILS_WRITER_UTILS_H_ +#endif // GAR_UTIL_WRITER_UTIL_H_ diff --git a/cpp/include/gar/utils/yaml.h b/cpp/include/gar/util/yaml.h similarity index 93% rename from cpp/include/gar/utils/yaml.h rename to cpp/include/gar/util/yaml.h index 7719b1397..df0b1b3f1 100644 --- a/cpp/include/gar/utils/yaml.h +++ b/cpp/include/gar/util/yaml.h @@ -13,14 +13,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -#ifndef GAR_UTILS_YAML_H_ -#define GAR_UTILS_YAML_H_ +#ifndef GAR_UTIL_YAML_H_ +#define GAR_UTIL_YAML_H_ #include #include #include -#include "gar/utils/result.h" +#include "gar/util/result.h" // forward declaration namespace Yaml { @@ -65,4 +65,4 @@ class Yaml { }; } // namespace GAR_NAMESPACE_INTERNAL -#endif // GAR_UTILS_YAML_H_ +#endif // GAR_UTIL_YAML_H_ diff --git a/cpp/include/gar/writer/arrow_chunk_writer.h b/cpp/include/gar/writer/arrow_chunk_writer.h index 51f8ce13b..8576b91f1 100644 --- a/cpp/include/gar/writer/arrow_chunk_writer.h +++ b/cpp/include/gar/writer/arrow_chunk_writer.h @@ -21,13 +21,13 @@ limitations under the License. #include #include "gar/graph_info.h" -#include "gar/utils/data_type.h" -#include "gar/utils/filesystem.h" -#include "gar/utils/general_params.h" -#include "gar/utils/result.h" -#include "gar/utils/status.h" -#include "gar/utils/utils.h" -#include "gar/utils/writer_utils.h" +#include "gar/util/data_type.h" +#include "gar/util/filesystem.h" +#include "gar/util/general_params.h" +#include "gar/util/result.h" +#include "gar/util/status.h" +#include "gar/util/util.h" +#include "gar/util/writer_util.h" // forward declaration namespace arrow { diff --git a/cpp/src/arrow_chunk_reader.cc b/cpp/src/arrow_chunk_reader.cc index ec1e9a1f0..1ecb214bf 100644 --- a/cpp/src/arrow_chunk_reader.cc +++ b/cpp/src/arrow_chunk_reader.cc @@ -16,14 +16,13 @@ limitations under the License. #include "arrow/api.h" #include "gar/reader/arrow_chunk_reader.h" -#include "gar/utils/reader_utils.h" +#include "gar/util/reader_util.h" namespace GAR_NAMESPACE_INTERNAL { Result> VertexPropertyArrowChunkReader::GetChunk() noexcept { - GAR_RETURN_NOT_OK( - utils::CheckFilterOptions(filter_options_, property_group_)); + GAR_RETURN_NOT_OK(util::CheckFilterOptions(filter_options_, property_group_)); if (chunk_table_ == nullptr) { GAR_ASSIGN_OR_RAISE( auto chunk_file_path, @@ -53,11 +52,11 @@ VertexPropertyArrowChunkReader::GetRange() noexcept { return std::make_pair(seek_id_, seek_id_ + curr_chunk_size - row_offset); } -void VertexPropertyArrowChunkReader::Filter(utils::Filter filter) { +void VertexPropertyArrowChunkReader::Filter(util::Filter filter) { filter_options_.filter = filter; } -void VertexPropertyArrowChunkReader::Select(utils::ColumnNames column_names) { +void VertexPropertyArrowChunkReader::Select(util::ColumnNames column_names) { filter_options_.columns = column_names; } @@ -79,8 +78,8 @@ Status AdjListArrowChunkReader::seek_src(IdType id) noexcept { if (vertex_chunk_index_ != new_vertex_chunk_index) { vertex_chunk_index_ = new_vertex_chunk_index; GAR_ASSIGN_OR_RAISE( - chunk_num_, utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); chunk_table_.reset(); } @@ -88,8 +87,8 @@ Status AdjListArrowChunkReader::seek_src(IdType id) noexcept { return seek(0); // start from first chunk } else { GAR_ASSIGN_OR_RAISE(auto range, - utils::GetAdjListOffsetOfVertex(edge_info_, prefix_, - adj_list_type_, id)); + util::GetAdjListOffsetOfVertex(edge_info_, prefix_, + adj_list_type_, id)); return seek(range.first); } return Status::OK(); @@ -113,8 +112,8 @@ Status AdjListArrowChunkReader::seek_dst(IdType id) noexcept { if (vertex_chunk_index_ != new_vertex_chunk_index) { vertex_chunk_index_ = new_vertex_chunk_index; GAR_ASSIGN_OR_RAISE( - chunk_num_, utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); chunk_table_.reset(); } @@ -122,8 +121,8 @@ Status AdjListArrowChunkReader::seek_dst(IdType id) noexcept { return seek(0); // start from the first chunk } else { GAR_ASSIGN_OR_RAISE(auto range, - utils::GetAdjListOffsetOfVertex(edge_info_, prefix_, - adj_list_type_, id)); + util::GetAdjListOffsetOfVertex(edge_info_, prefix_, + adj_list_type_, id)); return seek(range.first); } } @@ -172,8 +171,8 @@ Status AdjListPropertyArrowChunkReader::seek_src(IdType id) noexcept { if (vertex_chunk_index_ != new_vertex_chunk_index) { vertex_chunk_index_ = new_vertex_chunk_index; GAR_ASSIGN_OR_RAISE( - chunk_num_, utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); chunk_table_.reset(); } @@ -181,8 +180,8 @@ Status AdjListPropertyArrowChunkReader::seek_src(IdType id) noexcept { return seek(0); // start from first chunk } else { GAR_ASSIGN_OR_RAISE(auto range, - utils::GetAdjListOffsetOfVertex(edge_info_, prefix_, - adj_list_type_, id)); + util::GetAdjListOffsetOfVertex(edge_info_, prefix_, + adj_list_type_, id)); return seek(range.first); } return Status::OK(); @@ -206,8 +205,8 @@ Status AdjListPropertyArrowChunkReader::seek_dst(IdType id) noexcept { if (vertex_chunk_index_ != new_vertex_chunk_index) { vertex_chunk_index_ = new_vertex_chunk_index; GAR_ASSIGN_OR_RAISE( - chunk_num_, utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); chunk_table_.reset(); } @@ -215,8 +214,8 @@ Status AdjListPropertyArrowChunkReader::seek_dst(IdType id) noexcept { return seek(0); // start from the first chunk } else { GAR_ASSIGN_OR_RAISE(auto range, - utils::GetAdjListOffsetOfVertex(edge_info_, prefix_, - adj_list_type_, id)); + util::GetAdjListOffsetOfVertex(edge_info_, prefix_, + adj_list_type_, id)); return seek(range.first); } } @@ -237,8 +236,7 @@ AdjListOffsetArrowChunkReader::GetChunk() noexcept { Result> AdjListPropertyArrowChunkReader::GetChunk() noexcept { - GAR_RETURN_NOT_OK( - utils::CheckFilterOptions(filter_options_, property_group_)); + GAR_RETURN_NOT_OK(util::CheckFilterOptions(filter_options_, property_group_)); if (chunk_table_ == nullptr) { GAR_ASSIGN_OR_RAISE( auto chunk_file_path, @@ -253,11 +251,11 @@ AdjListPropertyArrowChunkReader::GetChunk() noexcept { return chunk_table_->Slice(row_offset); } -void AdjListPropertyArrowChunkReader::Filter(utils::Filter filter) { +void AdjListPropertyArrowChunkReader::Filter(util::Filter filter) { filter_options_.filter = filter; } -void AdjListPropertyArrowChunkReader::Select(utils::ColumnNames column_names) { +void AdjListPropertyArrowChunkReader::Select(util::ColumnNames column_names) { filter_options_.columns = column_names; } diff --git a/cpp/src/chunk_info_reader.cc b/cpp/src/chunk_info_reader.cc index 36b43c00a..047f6e2ab 100644 --- a/cpp/src/chunk_info_reader.cc +++ b/cpp/src/chunk_info_reader.cc @@ -16,7 +16,7 @@ limitations under the License. #include #include "gar/reader/chunk_info_reader.h" -#include "gar/utils/reader_utils.h" +#include "gar/util/reader_util.h" namespace GAR_NAMESPACE_INTERNAL { @@ -38,16 +38,16 @@ Status AdjListChunkInfoReader::seek_src(IdType id) noexcept { if (vertex_chunk_index_ != new_vertex_chunk_index) { vertex_chunk_index_ = new_vertex_chunk_index; GAR_ASSIGN_OR_RAISE( - chunk_num_, utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); } if (adj_list_type_ == AdjListType::unordered_by_source) { return seek(0); // start from first chunk } else { GAR_ASSIGN_OR_RAISE(auto offset_pair, - utils::GetAdjListOffsetOfVertex(edge_info_, prefix_, - adj_list_type_, id)); + util::GetAdjListOffsetOfVertex(edge_info_, prefix_, + adj_list_type_, id)); return seek(offset_pair.first); } return Status::OK(); @@ -71,16 +71,16 @@ Status AdjListChunkInfoReader::seek_dst(IdType id) noexcept { if (vertex_chunk_index_ != new_vertex_chunk_index) { vertex_chunk_index_ = new_vertex_chunk_index; GAR_ASSIGN_OR_RAISE( - chunk_num_, utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); } if (adj_list_type_ == AdjListType::unordered_by_dest) { return seek(0); // start from the first chunk } else { GAR_ASSIGN_OR_RAISE(auto range, - utils::GetAdjListOffsetOfVertex(edge_info_, prefix_, - adj_list_type_, id)); + util::GetAdjListOffsetOfVertex(edge_info_, prefix_, + adj_list_type_, id)); return seek(range.first); } } @@ -103,15 +103,15 @@ Status AdjListPropertyChunkInfoReader::seek_src(IdType id) noexcept { if (vertex_chunk_index_ != new_vertex_chunk_index) { vertex_chunk_index_ = new_vertex_chunk_index; GAR_ASSIGN_OR_RAISE( - chunk_num_, utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); } if (adj_list_type_ == AdjListType::unordered_by_source) { return seek(0); // start from first chunk } else { GAR_ASSIGN_OR_RAISE(auto range, - utils::GetAdjListOffsetOfVertex(edge_info_, prefix_, - adj_list_type_, id)); + util::GetAdjListOffsetOfVertex(edge_info_, prefix_, + adj_list_type_, id)); return seek(range.first); } return Status::OK(); @@ -135,16 +135,16 @@ Status AdjListPropertyChunkInfoReader::seek_dst(IdType id) noexcept { if (vertex_chunk_index_ != new_vertex_chunk_index) { vertex_chunk_index_ = new_vertex_chunk_index; GAR_ASSIGN_OR_RAISE( - chunk_num_, utils::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, - vertex_chunk_index_)); + chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_, + vertex_chunk_index_)); } if (adj_list_type_ == AdjListType::unordered_by_dest) { return seek(0); // start from the first chunk } else { GAR_ASSIGN_OR_RAISE(auto range, - utils::GetAdjListOffsetOfVertex(edge_info_, prefix_, - adj_list_type_, id)); + util::GetAdjListOffsetOfVertex(edge_info_, prefix_, + adj_list_type_, id)); return seek(range.first); } } diff --git a/cpp/src/data_type.cc b/cpp/src/data_type.cc index da2c11736..1229c7b55 100644 --- a/cpp/src/data_type.cc +++ b/cpp/src/data_type.cc @@ -18,7 +18,7 @@ limitations under the License. #include "arrow/api.h" #include "arrow/type.h" -#include "gar/utils/data_type.h" +#include "gar/util/data_type.h" namespace GAR_NAMESPACE_INTERNAL { diff --git a/cpp/src/edges_builder.cc b/cpp/src/edges_builder.cc index 50ef2dea8..9d6ed218d 100644 --- a/cpp/src/edges_builder.cc +++ b/cpp/src/edges_builder.cc @@ -14,8 +14,8 @@ limitations under the License. */ #include "gar/writer/edges_builder.h" -#include "gar/utils/convert_to_arrow_type.h" -#include "gar/utils/general_params.h" +#include "gar/util/convert_to_arrow_type.h" +#include "gar/util/general_params.h" namespace GAR_NAMESPACE_INTERNAL { namespace builder { diff --git a/cpp/src/expression.cc b/cpp/src/expression.cc index e968efa34..549766edb 100644 --- a/cpp/src/expression.cc +++ b/cpp/src/expression.cc @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "gar/utils/expression.h" +#include "gar/util/expression.h" namespace GAR_NAMESPACE_INTERNAL { diff --git a/cpp/src/filesystem.cc b/cpp/src/filesystem.cc index d10b45c3b..f4f7c3eb2 100644 --- a/cpp/src/filesystem.cc +++ b/cpp/src/filesystem.cc @@ -20,7 +20,7 @@ limitations under the License. #include "arrow/ipc/writer.h" #include "parquet/arrow/writer.h" -#include "gar/utils/filesystem.h" +#include "gar/util/filesystem.h" namespace GAR_NAMESPACE_INTERNAL { namespace ds = arrow::dataset; @@ -94,7 +94,7 @@ std::shared_ptr FileSystem::GetFileFormat( Result> FileSystem::ReadFileToTable( const std::string& path, FileType file_type, - const utils::FilterOptions& options) const noexcept { + const util::FilterOptions& options) const noexcept { std::shared_ptr format = GetFileFormat(file_type); GAR_RETURN_ON_ARROW_ERROR_AND_ASSIGN( auto factory, arrow::dataset::FileSystemDatasetFactory::Make( diff --git a/cpp/src/graph.cc b/cpp/src/graph.cc index e1147577a..aec125528 100644 --- a/cpp/src/graph.cc +++ b/cpp/src/graph.cc @@ -14,7 +14,7 @@ limitations under the License. */ #include "gar/graph.h" -#include "gar/utils/convert_to_arrow_type.h" +#include "gar/util/convert_to_arrow_type.h" namespace GAR_NAMESPACE_INTERNAL { diff --git a/cpp/src/graph_info.cc b/cpp/src/graph_info.cc index 8b4c444c0..b3dc6d8e9 100644 --- a/cpp/src/graph_info.cc +++ b/cpp/src/graph_info.cc @@ -18,8 +18,8 @@ limitations under the License. #include "yaml/Yaml.hpp" #include "gar/graph_info.h" -#include "gar/utils/filesystem.h" -#include "gar/utils/yaml.h" +#include "gar/util/filesystem.h" +#include "gar/util/yaml.h" namespace GAR_NAMESPACE_INTERNAL { diff --git a/cpp/src/reader_utils.cc b/cpp/src/reader_util.cc similarity index 98% rename from cpp/src/reader_utils.cc rename to cpp/src/reader_util.cc index a0e6ea5e2..fec5ef4ca 100644 --- a/cpp/src/reader_utils.cc +++ b/cpp/src/reader_util.cc @@ -21,12 +21,12 @@ limitations under the License. #include "parquet/arrow/reader.h" #include "gar/graph_info.h" -#include "gar/utils/filesystem.h" -#include "gar/utils/reader_utils.h" +#include "gar/util/filesystem.h" +#include "gar/util/reader_util.h" namespace GAR_NAMESPACE_INTERNAL { -namespace utils { +namespace util { /** * @brief Checks whether the property names in the FilterOptions match the @@ -191,6 +191,6 @@ Result GetEdgeNum(const std::string& prefix, const EdgeInfo& edge_info, return edge_num; } -} // namespace utils +} // namespace util } // namespace GAR_NAMESPACE_INTERNAL diff --git a/cpp/src/utils.cc b/cpp/src/util.cc similarity index 99% rename from cpp/src/utils.cc rename to cpp/src/util.cc index 5aca812c9..e71869697 100644 --- a/cpp/src/utils.cc +++ b/cpp/src/util.cc @@ -18,7 +18,7 @@ limitations under the License. #include "arrow/api.h" -#include "gar/utils/utils.h" +#include "gar/util/util.h" namespace GAR_NAMESPACE_INTERNAL { diff --git a/cpp/src/version_parser.cc b/cpp/src/version_parser.cc index 4747c39ec..e5a62b886 100644 --- a/cpp/src/version_parser.cc +++ b/cpp/src/version_parser.cc @@ -17,7 +17,7 @@ limitations under the License. #include // NOLINT #include -#include "gar/utils/version_parser.h" +#include "gar/util/version_parser.h" namespace GAR_NAMESPACE_INTERNAL { diff --git a/cpp/src/vertices_builder.cc b/cpp/src/vertices_builder.cc index ebe47b937..34c4dadc2 100644 --- a/cpp/src/vertices_builder.cc +++ b/cpp/src/vertices_builder.cc @@ -14,7 +14,7 @@ limitations under the License. */ #include "gar/writer/vertices_builder.h" -#include "gar/utils/convert_to_arrow_type.h" +#include "gar/util/convert_to_arrow_type.h" namespace GAR_NAMESPACE_INTERNAL { namespace builder { diff --git a/cpp/src/yaml.cc b/cpp/src/yaml.cc index 30b50587c..baae4c106 100644 --- a/cpp/src/yaml.cc +++ b/cpp/src/yaml.cc @@ -18,8 +18,8 @@ limitations under the License. #include "yaml/Yaml.hpp" -#include "gar/utils/result.h" -#include "gar/utils/yaml.h" +#include "gar/util/result.h" +#include "gar/util/yaml.h" namespace GAR_NAMESPACE_INTERNAL { diff --git a/cpp/test/test_arrow_chunk_reader.cc b/cpp/test/test_arrow_chunk_reader.cc index 2801e2c08..e4a47f732 100644 --- a/cpp/test/test_arrow_chunk_reader.cc +++ b/cpp/test/test_arrow_chunk_reader.cc @@ -28,7 +28,7 @@ using GAR_NAMESPACE::_Equal; using GAR_NAMESPACE::_LessThan; using GAR_NAMESPACE::_Literal; using GAR_NAMESPACE::_Property; -using GAR_NAMESPACE::utils::FilterOptions; +using GAR_NAMESPACE::util::FilterOptions; TEST_CASE("test_vertex_property_arrow_chunk_reader") { std::string root; diff --git a/cpp/test/test_info.cc b/cpp/test/test_info.cc index 93fd174be..941e34714 100644 --- a/cpp/test/test_info.cc +++ b/cpp/test/test_info.cc @@ -21,8 +21,8 @@ limitations under the License. #include "./util.h" #include "gar/graph_info.h" -#include "gar/utils/filesystem.h" -#include "gar/utils/version_parser.h" +#include "gar/util/filesystem.h" +#include "gar/util/version_parser.h" #define CATCH_CONFIG_MAIN #include diff --git a/cpp/test/util.h b/cpp/test/util.h index a4c407e1d..e12613c8c 100644 --- a/cpp/test/util.h +++ b/cpp/test/util.h @@ -16,7 +16,7 @@ limitations under the License. #include #include -#include "gar/utils/status.h" +#include "gar/util/status.h" #ifndef CPP_TEST_UTIL_H_ #define CPP_TEST_UTIL_H_ diff --git a/java/README.md b/java/README.md index 458330937..25db3063a 100644 --- a/java/README.md +++ b/java/README.md @@ -2,6 +2,8 @@ This directory contains the code and build system for the GraphAr Java library which powered by [Alibaba-FastFFI](https://github.com/alibaba/fastFFI). +NOTE: This project is still under development, and we will release it soon. + ## Dependencies ### Java diff --git a/java/src/main/java/com/alibaba/graphar/graphinfo/EdgeInfo.java b/java/src/main/java/com/alibaba/graphar/graphinfo/EdgeInfo.java index c92bf46de..380e84cbe 100644 --- a/java/src/main/java/com/alibaba/graphar/graphinfo/EdgeInfo.java +++ b/java/src/main/java/com/alibaba/graphar/graphinfo/EdgeInfo.java @@ -14,9 +14,9 @@ package com.alibaba.graphar.graphinfo; -import static com.alibaba.graphar.utils.CppClassName.GAR_EDGE_INFO; -import static com.alibaba.graphar.utils.CppClassName.GAR_ID_TYPE; -import static com.alibaba.graphar.utils.CppHeaderName.GAR_GRAPH_INFO_H; +import static com.alibaba.graphar.util.CppClassName.GAR_EDGE_INFO; +import static com.alibaba.graphar.util.CppClassName.GAR_ID_TYPE; +import static com.alibaba.graphar.util.CppHeaderName.GAR_GRAPH_INFO_H; import com.alibaba.fastffi.CXXHead; import com.alibaba.fastffi.CXXPointer; @@ -32,9 +32,9 @@ import com.alibaba.graphar.types.AdjListType; import com.alibaba.graphar.types.DataType; import com.alibaba.graphar.types.FileType; -import com.alibaba.graphar.utils.InfoVersion; -import com.alibaba.graphar.utils.Result; -import com.alibaba.graphar.utils.Status; +import com.alibaba.graphar.util.InfoVersion; +import com.alibaba.graphar.util.Result; +import com.alibaba.graphar.util.Status; /** EdgeInfo is a class that stores metadata information about an edge. */ @FFIGen diff --git a/java/src/main/java/com/alibaba/graphar/graphinfo/GraphInfo.java b/java/src/main/java/com/alibaba/graphar/graphinfo/GraphInfo.java index b4be4c909..016f65517 100644 --- a/java/src/main/java/com/alibaba/graphar/graphinfo/GraphInfo.java +++ b/java/src/main/java/com/alibaba/graphar/graphinfo/GraphInfo.java @@ -14,8 +14,8 @@ package com.alibaba.graphar.graphinfo; -import static com.alibaba.graphar.utils.CppClassName.GAR_GRAPH_INFO; -import static com.alibaba.graphar.utils.CppHeaderName.GAR_GRAPH_INFO_H; +import static com.alibaba.graphar.util.CppClassName.GAR_GRAPH_INFO; +import static com.alibaba.graphar.util.CppHeaderName.GAR_GRAPH_INFO_H; import com.alibaba.fastffi.CXXHead; import com.alibaba.fastffi.CXXPointer; @@ -31,9 +31,9 @@ import com.alibaba.graphar.stdcxx.StdMap; import com.alibaba.graphar.stdcxx.StdString; import com.alibaba.graphar.types.AdjListType; -import com.alibaba.graphar.utils.InfoVersion; -import com.alibaba.graphar.utils.Result; -import com.alibaba.graphar.utils.Status; +import com.alibaba.graphar.util.InfoVersion; +import com.alibaba.graphar.util.Result; +import com.alibaba.graphar.util.Status; /** GraphInfo is a class to store the graph meta information. */ @FFIGen diff --git a/java/src/main/java/com/alibaba/graphar/graphinfo/Property.java b/java/src/main/java/com/alibaba/graphar/graphinfo/Property.java index fb8a5ff32..7e31c3e90 100644 --- a/java/src/main/java/com/alibaba/graphar/graphinfo/Property.java +++ b/java/src/main/java/com/alibaba/graphar/graphinfo/Property.java @@ -14,8 +14,8 @@ package com.alibaba.graphar.graphinfo; -import static com.alibaba.graphar.utils.CppClassName.GAR_PROPERTY; -import static com.alibaba.graphar.utils.CppHeaderName.GAR_GRAPH_INFO_H; +import static com.alibaba.graphar.util.CppClassName.GAR_PROPERTY; +import static com.alibaba.graphar.util.CppHeaderName.GAR_GRAPH_INFO_H; import com.alibaba.fastffi.CXXHead; import com.alibaba.fastffi.CXXPointer; diff --git a/java/src/main/java/com/alibaba/graphar/graphinfo/PropertyGroup.java b/java/src/main/java/com/alibaba/graphar/graphinfo/PropertyGroup.java index 558b314aa..503ce7ec7 100644 --- a/java/src/main/java/com/alibaba/graphar/graphinfo/PropertyGroup.java +++ b/java/src/main/java/com/alibaba/graphar/graphinfo/PropertyGroup.java @@ -14,8 +14,8 @@ package com.alibaba.graphar.graphinfo; -import static com.alibaba.graphar.utils.CppClassName.GAR_PROPERTY_GROUP; -import static com.alibaba.graphar.utils.CppHeaderName.GAR_GRAPH_INFO_H; +import static com.alibaba.graphar.util.CppClassName.GAR_PROPERTY_GROUP; +import static com.alibaba.graphar.util.CppHeaderName.GAR_GRAPH_INFO_H; import com.alibaba.fastffi.CXXHead; import com.alibaba.fastffi.CXXOperator; diff --git a/java/src/main/java/com/alibaba/graphar/graphinfo/VertexInfo.java b/java/src/main/java/com/alibaba/graphar/graphinfo/VertexInfo.java index 44876c27c..3eb4b5b3d 100644 --- a/java/src/main/java/com/alibaba/graphar/graphinfo/VertexInfo.java +++ b/java/src/main/java/com/alibaba/graphar/graphinfo/VertexInfo.java @@ -14,9 +14,9 @@ package com.alibaba.graphar.graphinfo; -import static com.alibaba.graphar.utils.CppClassName.GAR_ID_TYPE; -import static com.alibaba.graphar.utils.CppClassName.GAR_VERTEX_INFO; -import static com.alibaba.graphar.utils.CppHeaderName.GAR_GRAPH_INFO_H; +import static com.alibaba.graphar.util.CppClassName.GAR_ID_TYPE; +import static com.alibaba.graphar.util.CppClassName.GAR_VERTEX_INFO; +import static com.alibaba.graphar.util.CppHeaderName.GAR_GRAPH_INFO_H; import com.alibaba.fastffi.CXXHead; import com.alibaba.fastffi.CXXPointer; @@ -31,9 +31,9 @@ import com.alibaba.graphar.stdcxx.StdString; import com.alibaba.graphar.stdcxx.StdVector; import com.alibaba.graphar.types.DataType; -import com.alibaba.graphar.utils.InfoVersion; -import com.alibaba.graphar.utils.Result; -import com.alibaba.graphar.utils.Status; +import com.alibaba.graphar.util.InfoVersion; +import com.alibaba.graphar.util.Result; +import com.alibaba.graphar.util.Status; /** VertexInfo is a class that stores metadata information about a vertex. */ @FFIGen diff --git a/java/src/main/java/com/alibaba/graphar/graphinfo/package-info.java b/java/src/main/java/com/alibaba/graphar/graphinfo/package-info.java index 84384151f..0d55f0cea 100644 --- a/java/src/main/java/com/alibaba/graphar/graphinfo/package-info.java +++ b/java/src/main/java/com/alibaba/graphar/graphinfo/package-info.java @@ -17,4 +17,4 @@ import com.alibaba.fastffi.FFIApplication; -import static com.alibaba.graphar.utils.JNILibraryName.GAR_JNI_LIBRARY_NAME; +import static com.alibaba.graphar.util.JNILibraryName.GAR_JNI_LIBRARY_NAME; diff --git a/java/src/main/java/com/alibaba/graphar/stdcxx/StdMap.java b/java/src/main/java/com/alibaba/graphar/stdcxx/StdMap.java index 1b0fa2c70..de5853e60 100644 --- a/java/src/main/java/com/alibaba/graphar/stdcxx/StdMap.java +++ b/java/src/main/java/com/alibaba/graphar/stdcxx/StdMap.java @@ -23,10 +23,10 @@ import com.alibaba.fastffi.FFIPointer; import com.alibaba.fastffi.FFITypeAlias; -import static com.alibaba.graphar.utils.CppClassName.GAR_EDGE_INFO; -import static com.alibaba.graphar.utils.CppClassName.GAR_VERTEX_INFO; -import static com.alibaba.graphar.utils.CppClassName.STD_STRING; -import static com.alibaba.graphar.utils.CppHeaderName.GAR_GRAPH_INFO_H; +import static com.alibaba.graphar.util.CppClassName.GAR_EDGE_INFO; +import static com.alibaba.graphar.util.CppClassName.GAR_VERTEX_INFO; +import static com.alibaba.graphar.util.CppClassName.STD_STRING; +import static com.alibaba.graphar.util.CppHeaderName.GAR_GRAPH_INFO_H; @FFIGen @CXXHead(system = {"map"}) diff --git a/java/src/main/java/com/alibaba/graphar/stdcxx/StdVector.java b/java/src/main/java/com/alibaba/graphar/stdcxx/StdVector.java index 754e4df7d..6e708abf0 100644 --- a/java/src/main/java/com/alibaba/graphar/stdcxx/StdVector.java +++ b/java/src/main/java/com/alibaba/graphar/stdcxx/StdVector.java @@ -14,8 +14,8 @@ package com.alibaba.graphar.stdcxx; -import static com.alibaba.graphar.utils.CppClassName.GAR_PROPERTY; -import static com.alibaba.graphar.utils.CppHeaderName.GAR_GRAPH_INFO_H; +import static com.alibaba.graphar.util.CppClassName.GAR_PROPERTY; +import static com.alibaba.graphar.util.CppHeaderName.GAR_GRAPH_INFO_H; import com.alibaba.fastffi.CXXHead; import com.alibaba.fastffi.CXXOperator; diff --git a/java/src/main/java/com/alibaba/graphar/stdcxx/package-info.java b/java/src/main/java/com/alibaba/graphar/stdcxx/package-info.java index 2f782f961..f07ca9c9f 100644 --- a/java/src/main/java/com/alibaba/graphar/stdcxx/package-info.java +++ b/java/src/main/java/com/alibaba/graphar/stdcxx/package-info.java @@ -17,4 +17,4 @@ import com.alibaba.fastffi.FFIApplication; -import static com.alibaba.graphar.utils.JNILibraryName.GAR_JNI_LIBRARY_NAME; +import static com.alibaba.graphar.util.JNILibraryName.GAR_JNI_LIBRARY_NAME; diff --git a/java/src/main/java/com/alibaba/graphar/types/AdjListType.java b/java/src/main/java/com/alibaba/graphar/types/AdjListType.java index 232bba9fc..69e743475 100644 --- a/java/src/main/java/com/alibaba/graphar/types/AdjListType.java +++ b/java/src/main/java/com/alibaba/graphar/types/AdjListType.java @@ -14,7 +14,7 @@ package com.alibaba.graphar.types; -import static com.alibaba.graphar.utils.CppClassName.GAR_ADJ_LIST_TYPE; +import static com.alibaba.graphar.util.CppClassName.GAR_ADJ_LIST_TYPE; import com.alibaba.fastffi.CXXEnum; import com.alibaba.fastffi.FFITypeAlias; diff --git a/java/src/main/java/com/alibaba/graphar/types/DataType.java b/java/src/main/java/com/alibaba/graphar/types/DataType.java index 783ce6d4d..53e3e835d 100644 --- a/java/src/main/java/com/alibaba/graphar/types/DataType.java +++ b/java/src/main/java/com/alibaba/graphar/types/DataType.java @@ -14,8 +14,8 @@ package com.alibaba.graphar.types; -import static com.alibaba.graphar.utils.CppClassName.GAR_DATA_TYPE; -import static com.alibaba.graphar.utils.CppHeaderName.GAR_GRAPH_INFO_H; +import static com.alibaba.graphar.util.CppClassName.GAR_DATA_TYPE; +import static com.alibaba.graphar.util.CppHeaderName.GAR_GRAPH_INFO_H; import com.alibaba.fastffi.CXXHead; import com.alibaba.fastffi.CXXOperator; diff --git a/java/src/main/java/com/alibaba/graphar/types/FileType.java b/java/src/main/java/com/alibaba/graphar/types/FileType.java index b9f97ffcc..435256f87 100644 --- a/java/src/main/java/com/alibaba/graphar/types/FileType.java +++ b/java/src/main/java/com/alibaba/graphar/types/FileType.java @@ -14,7 +14,7 @@ package com.alibaba.graphar.types; -import static com.alibaba.graphar.utils.CppClassName.GAR_FILE_TYPE; +import static com.alibaba.graphar.util.CppClassName.GAR_FILE_TYPE; import com.alibaba.fastffi.CXXEnum; import com.alibaba.fastffi.FFITypeAlias; diff --git a/java/src/main/java/com/alibaba/graphar/types/Type.java b/java/src/main/java/com/alibaba/graphar/types/Type.java index efed02225..e4be82e30 100644 --- a/java/src/main/java/com/alibaba/graphar/types/Type.java +++ b/java/src/main/java/com/alibaba/graphar/types/Type.java @@ -18,7 +18,7 @@ import com.alibaba.fastffi.FFITypeAlias; import com.alibaba.fastffi.FFITypeRefiner; -import static com.alibaba.graphar.utils.CppClassName.GAR_TYPE; +import static com.alibaba.graphar.util.CppClassName.GAR_TYPE; @FFITypeAlias(GAR_TYPE) @FFITypeRefiner("com.alibaba.graphar.types.Type.get") diff --git a/java/src/main/java/com/alibaba/graphar/types/package-info.java b/java/src/main/java/com/alibaba/graphar/types/package-info.java index 957f15bbd..fd0323426 100644 --- a/java/src/main/java/com/alibaba/graphar/types/package-info.java +++ b/java/src/main/java/com/alibaba/graphar/types/package-info.java @@ -15,6 +15,6 @@ @FFIApplication(jniLibrary = GAR_JNI_LIBRARY_NAME) package com.alibaba.graphar.types; -import static com.alibaba.graphar.utils.JNILibraryName.GAR_JNI_LIBRARY_NAME; +import static com.alibaba.graphar.util.JNILibraryName.GAR_JNI_LIBRARY_NAME; import com.alibaba.fastffi.FFIApplication; diff --git a/java/src/main/java/com/alibaba/graphar/utils/CppClassName.java b/java/src/main/java/com/alibaba/graphar/util/CppClassName.java similarity index 95% rename from java/src/main/java/com/alibaba/graphar/utils/CppClassName.java rename to java/src/main/java/com/alibaba/graphar/util/CppClassName.java index fd48c0874..bed1168e1 100644 --- a/java/src/main/java/com/alibaba/graphar/utils/CppClassName.java +++ b/java/src/main/java/com/alibaba/graphar/util/CppClassName.java @@ -12,14 +12,14 @@ * limitations under the License. */ -package com.alibaba.graphar.utils; +package com.alibaba.graphar.util; public class CppClassName { // stdcxx public static final String STD_STRING = "std::string"; public static final String STD_MAP = "std::map"; - // utils + // util public static final String GAR_INFO_VERSION = "GraphArchive::InfoVersion"; public static final String GAR_STATUS_CODE = "GraphArchive::StatusCode"; public static final String GAR_STATUS = "GraphArchive::Status"; diff --git a/java/src/main/java/com/alibaba/graphar/utils/CppHeaderName.java b/java/src/main/java/com/alibaba/graphar/util/CppHeaderName.java similarity index 92% rename from java/src/main/java/com/alibaba/graphar/utils/CppHeaderName.java rename to java/src/main/java/com/alibaba/graphar/util/CppHeaderName.java index 9b778e35c..07c8661c6 100644 --- a/java/src/main/java/com/alibaba/graphar/utils/CppHeaderName.java +++ b/java/src/main/java/com/alibaba/graphar/util/CppHeaderName.java @@ -12,7 +12,7 @@ * limitations under the License. */ -package com.alibaba.graphar.utils; +package com.alibaba.graphar.util; public class CppHeaderName { public static final String GAR_GRAPH_INFO_H = "gar/graph_info.h"; diff --git a/java/src/main/java/com/alibaba/graphar/utils/InfoVersion.java b/java/src/main/java/com/alibaba/graphar/util/InfoVersion.java similarity index 94% rename from java/src/main/java/com/alibaba/graphar/utils/InfoVersion.java rename to java/src/main/java/com/alibaba/graphar/util/InfoVersion.java index ed9a572b2..582445bc6 100644 --- a/java/src/main/java/com/alibaba/graphar/utils/InfoVersion.java +++ b/java/src/main/java/com/alibaba/graphar/util/InfoVersion.java @@ -12,10 +12,10 @@ * limitations under the License. */ -package com.alibaba.graphar.utils; +package com.alibaba.graphar.util; -import static com.alibaba.graphar.utils.CppClassName.GAR_INFO_VERSION; -import static com.alibaba.graphar.utils.CppHeaderName.GAR_GRAPH_INFO_H; +import static com.alibaba.graphar.util.CppClassName.GAR_INFO_VERSION; +import static com.alibaba.graphar.util.CppHeaderName.GAR_GRAPH_INFO_H; import com.alibaba.fastffi.CXXHead; import com.alibaba.fastffi.CXXOperator; diff --git a/java/src/main/java/com/alibaba/graphar/utils/JNILibraryName.java b/java/src/main/java/com/alibaba/graphar/util/JNILibraryName.java similarity index 92% rename from java/src/main/java/com/alibaba/graphar/utils/JNILibraryName.java rename to java/src/main/java/com/alibaba/graphar/util/JNILibraryName.java index 8554a59bb..e8683d7d6 100644 --- a/java/src/main/java/com/alibaba/graphar/utils/JNILibraryName.java +++ b/java/src/main/java/com/alibaba/graphar/util/JNILibraryName.java @@ -12,7 +12,7 @@ * limitations under the License. */ -package com.alibaba.graphar.utils; +package com.alibaba.graphar.util; public class JNILibraryName { public static final String GAR_JNI_LIBRARY_NAME = "gar-jni"; diff --git a/java/src/main/java/com/alibaba/graphar/utils/Result.java b/java/src/main/java/com/alibaba/graphar/util/Result.java similarity index 70% rename from java/src/main/java/com/alibaba/graphar/utils/Result.java rename to java/src/main/java/com/alibaba/graphar/util/Result.java index 8e001f01e..02829aebd 100644 --- a/java/src/main/java/com/alibaba/graphar/utils/Result.java +++ b/java/src/main/java/com/alibaba/graphar/util/Result.java @@ -12,18 +12,18 @@ * limitations under the License. */ -package com.alibaba.graphar.utils; +package com.alibaba.graphar.util; -import static com.alibaba.graphar.utils.CppClassName.GAR_DATA_TYPE; -import static com.alibaba.graphar.utils.CppClassName.GAR_EDGE_INFO; -import static com.alibaba.graphar.utils.CppClassName.GAR_FILE_TYPE; -import static com.alibaba.graphar.utils.CppClassName.GAR_GRAPH_INFO; -import static com.alibaba.graphar.utils.CppClassName.GAR_INFO_VERSION; -import static com.alibaba.graphar.utils.CppClassName.GAR_PROPERTY_GROUP; -import static com.alibaba.graphar.utils.CppClassName.GAR_RESULT; -import static com.alibaba.graphar.utils.CppClassName.GAR_VERTEX_INFO; -import static com.alibaba.graphar.utils.CppClassName.STD_STRING; -import static com.alibaba.graphar.utils.CppHeaderName.GAR_GRAPH_INFO_H; +import static com.alibaba.graphar.util.CppClassName.GAR_DATA_TYPE; +import static com.alibaba.graphar.util.CppClassName.GAR_EDGE_INFO; +import static com.alibaba.graphar.util.CppClassName.GAR_FILE_TYPE; +import static com.alibaba.graphar.util.CppClassName.GAR_GRAPH_INFO; +import static com.alibaba.graphar.util.CppClassName.GAR_INFO_VERSION; +import static com.alibaba.graphar.util.CppClassName.GAR_PROPERTY_GROUP; +import static com.alibaba.graphar.util.CppClassName.GAR_RESULT; +import static com.alibaba.graphar.util.CppClassName.GAR_VERTEX_INFO; +import static com.alibaba.graphar.util.CppClassName.STD_STRING; +import static com.alibaba.graphar.util.CppHeaderName.GAR_GRAPH_INFO_H; import com.alibaba.fastffi.CXXHead; import com.alibaba.fastffi.CXXOperator; @@ -46,7 +46,7 @@ @CXXTemplate(cxx = GAR_PROPERTY_GROUP, java = "com.alibaba.graphar.graphinfo.PropertyGroup") @CXXTemplate(cxx = GAR_DATA_TYPE, java = "com.alibaba.graphar.types.DataType") @CXXTemplate(cxx = GAR_FILE_TYPE, java = "com.alibaba.graphar.types.FileType") -@CXXTemplate(cxx = GAR_INFO_VERSION, java = "com.alibaba.graphar.utils.InfoVersion") +@CXXTemplate(cxx = GAR_INFO_VERSION, java = "com.alibaba.graphar.util.InfoVersion") public interface Result extends CXXPointer { @CXXReference diff --git a/java/src/main/java/com/alibaba/graphar/utils/Status.java b/java/src/main/java/com/alibaba/graphar/util/Status.java similarity index 89% rename from java/src/main/java/com/alibaba/graphar/utils/Status.java rename to java/src/main/java/com/alibaba/graphar/util/Status.java index fb7b03799..4ca71923f 100644 --- a/java/src/main/java/com/alibaba/graphar/utils/Status.java +++ b/java/src/main/java/com/alibaba/graphar/util/Status.java @@ -12,7 +12,7 @@ * limitations under the License. */ -package com.alibaba.graphar.utils; +package com.alibaba.graphar.util; import com.alibaba.fastffi.CXXHead; import com.alibaba.fastffi.CXXPointer; @@ -23,8 +23,8 @@ import com.alibaba.fastffi.FFITypeAlias; import com.alibaba.graphar.stdcxx.StdString; -import static com.alibaba.graphar.utils.CppClassName.GAR_STATUS; -import static com.alibaba.graphar.utils.CppHeaderName.GAR_GRAPH_INFO_H; +import static com.alibaba.graphar.util.CppClassName.GAR_STATUS; +import static com.alibaba.graphar.util.CppHeaderName.GAR_GRAPH_INFO_H; @FFIGen @FFITypeAlias(GAR_STATUS) diff --git a/java/src/main/java/com/alibaba/graphar/utils/StatusCode.java b/java/src/main/java/com/alibaba/graphar/util/StatusCode.java similarity index 90% rename from java/src/main/java/com/alibaba/graphar/utils/StatusCode.java rename to java/src/main/java/com/alibaba/graphar/util/StatusCode.java index eae4dde08..bad6dab83 100644 --- a/java/src/main/java/com/alibaba/graphar/utils/StatusCode.java +++ b/java/src/main/java/com/alibaba/graphar/util/StatusCode.java @@ -12,16 +12,16 @@ * limitations under the License. */ -package com.alibaba.graphar.utils; +package com.alibaba.graphar.util; import com.alibaba.fastffi.CXXEnum; import com.alibaba.fastffi.FFITypeAlias; import com.alibaba.fastffi.FFITypeRefiner; -import static com.alibaba.graphar.utils.CppClassName.GAR_STATUS_CODE; +import static com.alibaba.graphar.util.CppClassName.GAR_STATUS_CODE; @FFITypeAlias(GAR_STATUS_CODE) -@FFITypeRefiner("com.alibaba.graphar.utils.StatusCode.get") +@FFITypeRefiner("com.alibaba.graphar.util.StatusCode.get") public enum StatusCode implements CXXEnum { // success status kOK, diff --git a/java/src/main/java/com/alibaba/graphar/utils/package-info.java b/java/src/main/java/com/alibaba/graphar/util/package-info.java similarity index 84% rename from java/src/main/java/com/alibaba/graphar/utils/package-info.java rename to java/src/main/java/com/alibaba/graphar/util/package-info.java index 2b6e90c83..3f280a650 100644 --- a/java/src/main/java/com/alibaba/graphar/utils/package-info.java +++ b/java/src/main/java/com/alibaba/graphar/util/package-info.java @@ -13,8 +13,8 @@ */ @FFIApplication(jniLibrary = GAR_JNI_LIBRARY_NAME) -package com.alibaba.graphar.utils; +package com.alibaba.graphar.util; import com.alibaba.fastffi.FFIApplication; -import static com.alibaba.graphar.utils.JNILibraryName.GAR_JNI_LIBRARY_NAME; \ No newline at end of file +import static com.alibaba.graphar.util.JNILibraryName.GAR_JNI_LIBRARY_NAME; \ No newline at end of file diff --git a/java/src/test/java/com/alibaba/graphar/graphinfo/EdgeInfoTest.java b/java/src/test/java/com/alibaba/graphar/graphinfo/EdgeInfoTest.java index 0533807af..d9ec53617 100644 --- a/java/src/test/java/com/alibaba/graphar/graphinfo/EdgeInfoTest.java +++ b/java/src/test/java/com/alibaba/graphar/graphinfo/EdgeInfoTest.java @@ -6,8 +6,8 @@ import com.alibaba.graphar.types.DataType; import com.alibaba.graphar.types.FileType; import com.alibaba.graphar.types.Type; -import com.alibaba.graphar.utils.InfoVersion; -import com.alibaba.graphar.utils.Result; +import com.alibaba.graphar.util.InfoVersion; +import com.alibaba.graphar.util.Result; import org.junit.Assert; import org.junit.Test; diff --git a/java/src/test/java/com/alibaba/graphar/graphinfo/GraphInfoTest.java b/java/src/test/java/com/alibaba/graphar/graphinfo/GraphInfoTest.java index ccaac765c..11269caed 100644 --- a/java/src/test/java/com/alibaba/graphar/graphinfo/GraphInfoTest.java +++ b/java/src/test/java/com/alibaba/graphar/graphinfo/GraphInfoTest.java @@ -2,9 +2,9 @@ import com.alibaba.graphar.stdcxx.StdMap; import com.alibaba.graphar.stdcxx.StdString; -import com.alibaba.graphar.utils.InfoVersion; -import com.alibaba.graphar.utils.Result; -import com.alibaba.graphar.utils.Status; +import com.alibaba.graphar.util.InfoVersion; +import com.alibaba.graphar.util.Result; +import com.alibaba.graphar.util.Status; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; diff --git a/java/src/test/java/com/alibaba/graphar/graphinfo/VertexInfoTest.java b/java/src/test/java/com/alibaba/graphar/graphinfo/VertexInfoTest.java index 877464919..22727d988 100644 --- a/java/src/test/java/com/alibaba/graphar/graphinfo/VertexInfoTest.java +++ b/java/src/test/java/com/alibaba/graphar/graphinfo/VertexInfoTest.java @@ -5,8 +5,8 @@ import com.alibaba.graphar.types.DataType; import com.alibaba.graphar.types.FileType; import com.alibaba.graphar.types.Type; -import com.alibaba.graphar.utils.InfoVersion; -import com.alibaba.graphar.utils.Result; +import com.alibaba.graphar.util.InfoVersion; +import com.alibaba.graphar.util.Result; import org.junit.Assert; import org.junit.Test; diff --git a/java/src/test/java/com/alibaba/graphar/utils/InfoVersionTest.java b/java/src/test/java/com/alibaba/graphar/util/InfoVersionTest.java similarity index 97% rename from java/src/test/java/com/alibaba/graphar/utils/InfoVersionTest.java rename to java/src/test/java/com/alibaba/graphar/util/InfoVersionTest.java index 9b0ccc31a..d002547b6 100644 --- a/java/src/test/java/com/alibaba/graphar/utils/InfoVersionTest.java +++ b/java/src/test/java/com/alibaba/graphar/util/InfoVersionTest.java @@ -1,4 +1,4 @@ -package com.alibaba.graphar.utils; +package com.alibaba.graphar.util; import com.alibaba.graphar.stdcxx.StdString; import com.alibaba.graphar.stdcxx.StdVector; diff --git a/spark/src/main/scala/com/alibaba/graphar/datasources/GarDataSource.scala b/spark/src/main/scala/com/alibaba/graphar/datasources/GarDataSource.scala index 3ac54fbd9..b2a8213ef 100644 --- a/spark/src/main/scala/com/alibaba/graphar/datasources/GarDataSource.scala +++ b/spark/src/main/scala/com/alibaba/graphar/datasources/GarDataSource.scala @@ -35,7 +35,7 @@ import org.apache.spark.sql.util.CaseInsensitiveStringMap import org.apache.spark.sql.sources.DataSourceRegister import org.apache.spark.sql.connector.expressions.Transform -import com.alibaba.graphar.utils.Utils +import com.alibaba.graphar.util.Utils object GarUtils /** GarDataSource is a class to provide gar files as the data source for spark. */ diff --git a/spark/src/main/scala/com/alibaba/graphar/example/GraphAr2Neo4j.scala b/spark/src/main/scala/com/alibaba/graphar/example/GraphAr2Neo4j.scala index edb8626c7..b1207b79f 100644 --- a/spark/src/main/scala/com/alibaba/graphar/example/GraphAr2Neo4j.scala +++ b/spark/src/main/scala/com/alibaba/graphar/example/GraphAr2Neo4j.scala @@ -19,7 +19,7 @@ import com.alibaba.graphar.datasources._ import com.alibaba.graphar.reader.{VertexReader, EdgeReader} import com.alibaba.graphar.graph.GraphReader import com.alibaba.graphar.{GeneralParams, GraphInfo} -import com.alibaba.graphar.utils.Utils +import com.alibaba.graphar.util.Utils import java.io.{File, FileInputStream} import org.yaml.snakeyaml.Yaml diff --git a/spark/src/main/scala/com/alibaba/graphar/graph/GraphReader.scala b/spark/src/main/scala/com/alibaba/graphar/graph/GraphReader.scala index cfcbb423b..d99c71ba5 100644 --- a/spark/src/main/scala/com/alibaba/graphar/graph/GraphReader.scala +++ b/spark/src/main/scala/com/alibaba/graphar/graph/GraphReader.scala @@ -17,7 +17,7 @@ package com.alibaba.graphar.graph import com.alibaba.graphar.{GeneralParams, AdjListType, GraphInfo, VertexInfo, EdgeInfo} import com.alibaba.graphar.reader.{VertexReader, EdgeReader} -import com.alibaba.graphar.utils.IndexGenerator +import com.alibaba.graphar.util.IndexGenerator import org.apache.spark.sql.{DataFrame, SparkSession} import org.apache.spark.sql.types._ diff --git a/spark/src/main/scala/com/alibaba/graphar/graph/GraphWriter.scala b/spark/src/main/scala/com/alibaba/graphar/graph/GraphWriter.scala index 6de2ea267..3f8acb33e 100644 --- a/spark/src/main/scala/com/alibaba/graphar/graph/GraphWriter.scala +++ b/spark/src/main/scala/com/alibaba/graphar/graph/GraphWriter.scala @@ -17,8 +17,8 @@ package com.alibaba.graphar.graph import com.alibaba.graphar.{AdjListType, GraphInfo, VertexInfo, EdgeInfo, GeneralParams} import com.alibaba.graphar.writer.{VertexWriter, EdgeWriter} -import com.alibaba.graphar.utils.IndexGenerator -import com.alibaba.graphar.utils.Utils +import com.alibaba.graphar.util.IndexGenerator +import com.alibaba.graphar.util.Utils import org.apache.spark.sql.{DataFrame, SparkSession} import org.apache.spark.sql.types._ diff --git a/spark/src/main/scala/com/alibaba/graphar/reader/EdgeReader.scala b/spark/src/main/scala/com/alibaba/graphar/reader/EdgeReader.scala index 013a8479a..ef0fdef65 100644 --- a/spark/src/main/scala/com/alibaba/graphar/reader/EdgeReader.scala +++ b/spark/src/main/scala/com/alibaba/graphar/reader/EdgeReader.scala @@ -15,10 +15,10 @@ package com.alibaba.graphar.reader -import com.alibaba.graphar.utils.{IndexGenerator, DataFrameConcat} +import com.alibaba.graphar.util.{IndexGenerator, DataFrameConcat} import com.alibaba.graphar.{GeneralParams, EdgeInfo, FileType, AdjListType, PropertyGroup} import com.alibaba.graphar.datasources._ -import com.alibaba.graphar.utils.FileSystem +import com.alibaba.graphar.util.FileSystem import org.apache.spark.sql.{DataFrame, SparkSession} import org.apache.spark.sql.types._ diff --git a/spark/src/main/scala/com/alibaba/graphar/reader/VertexReader.scala b/spark/src/main/scala/com/alibaba/graphar/reader/VertexReader.scala index 58f348f50..17e4f82aa 100644 --- a/spark/src/main/scala/com/alibaba/graphar/reader/VertexReader.scala +++ b/spark/src/main/scala/com/alibaba/graphar/reader/VertexReader.scala @@ -15,10 +15,10 @@ package com.alibaba.graphar.reader -import com.alibaba.graphar.utils.{IndexGenerator, DataFrameConcat} +import com.alibaba.graphar.util.{IndexGenerator, DataFrameConcat} import com.alibaba.graphar.{GeneralParams, VertexInfo, FileType, PropertyGroup} import com.alibaba.graphar.datasources._ -import com.alibaba.graphar.utils.FileSystem +import com.alibaba.graphar.util.FileSystem import org.apache.spark.sql.{DataFrame, SparkSession} import org.apache.spark.sql.types._ diff --git a/spark/src/main/scala/com/alibaba/graphar/utils/DataFrameConcat.scala b/spark/src/main/scala/com/alibaba/graphar/util/DataFrameConcat.scala similarity index 98% rename from spark/src/main/scala/com/alibaba/graphar/utils/DataFrameConcat.scala rename to spark/src/main/scala/com/alibaba/graphar/util/DataFrameConcat.scala index aff767bf3..30e599850 100644 --- a/spark/src/main/scala/com/alibaba/graphar/utils/DataFrameConcat.scala +++ b/spark/src/main/scala/com/alibaba/graphar/util/DataFrameConcat.scala @@ -13,7 +13,7 @@ * limitations under the License. */ -package com.alibaba.graphar.utils +package com.alibaba.graphar.util import com.alibaba.graphar.GeneralParams diff --git a/spark/src/main/scala/com/alibaba/graphar/utils/FileSystem.scala b/spark/src/main/scala/com/alibaba/graphar/util/FileSystem.scala similarity index 99% rename from spark/src/main/scala/com/alibaba/graphar/utils/FileSystem.scala rename to spark/src/main/scala/com/alibaba/graphar/util/FileSystem.scala index e721b44cd..fca30fef4 100644 --- a/spark/src/main/scala/com/alibaba/graphar/utils/FileSystem.scala +++ b/spark/src/main/scala/com/alibaba/graphar/util/FileSystem.scala @@ -13,7 +13,7 @@ * limitations under the License. */ -package com.alibaba.graphar.utils +package com.alibaba.graphar.util import org.json4s._ import org.json4s.jackson.Serialization.write diff --git a/spark/src/main/scala/com/alibaba/graphar/utils/IndexGenerator.scala b/spark/src/main/scala/com/alibaba/graphar/util/IndexGenerator.scala similarity index 99% rename from spark/src/main/scala/com/alibaba/graphar/utils/IndexGenerator.scala rename to spark/src/main/scala/com/alibaba/graphar/util/IndexGenerator.scala index fb3948578..5dbc50b2c 100644 --- a/spark/src/main/scala/com/alibaba/graphar/utils/IndexGenerator.scala +++ b/spark/src/main/scala/com/alibaba/graphar/util/IndexGenerator.scala @@ -13,7 +13,7 @@ * limitations under the License. */ -package com.alibaba.graphar.utils +package com.alibaba.graphar.util import com.alibaba.graphar.GeneralParams diff --git a/spark/src/main/scala/com/alibaba/graphar/utils/Patitioner.scala b/spark/src/main/scala/com/alibaba/graphar/util/Patitioner.scala similarity index 98% rename from spark/src/main/scala/com/alibaba/graphar/utils/Patitioner.scala rename to spark/src/main/scala/com/alibaba/graphar/util/Patitioner.scala index 96faa3737..803974554 100644 --- a/spark/src/main/scala/com/alibaba/graphar/utils/Patitioner.scala +++ b/spark/src/main/scala/com/alibaba/graphar/util/Patitioner.scala @@ -13,7 +13,7 @@ * limitations under the License. */ -package com.alibaba.graphar.utils +package com.alibaba.graphar.util import org.apache.spark.sql.types._ import org.apache.spark.Partitioner diff --git a/spark/src/main/scala/com/alibaba/graphar/utils/Utils.scala b/spark/src/main/scala/com/alibaba/graphar/util/Utils.scala similarity index 99% rename from spark/src/main/scala/com/alibaba/graphar/utils/Utils.scala rename to spark/src/main/scala/com/alibaba/graphar/util/Utils.scala index 21f904233..32f18ccde 100644 --- a/spark/src/main/scala/com/alibaba/graphar/utils/Utils.scala +++ b/spark/src/main/scala/com/alibaba/graphar/util/Utils.scala @@ -13,7 +13,7 @@ * limitations under the License. */ -package com.alibaba.graphar.utils +package com.alibaba.graphar.util import scala.util.matching.Regex import org.apache.spark.sql.types._ diff --git a/spark/src/main/scala/com/alibaba/graphar/writer/EdgeWriter.scala b/spark/src/main/scala/com/alibaba/graphar/writer/EdgeWriter.scala index 1ac52196a..4ed77ba86 100644 --- a/spark/src/main/scala/com/alibaba/graphar/writer/EdgeWriter.scala +++ b/spark/src/main/scala/com/alibaba/graphar/writer/EdgeWriter.scala @@ -15,7 +15,7 @@ package com.alibaba.graphar.writer -import com.alibaba.graphar.utils.{FileSystem, ChunkPartitioner, EdgeChunkPartitioner} +import com.alibaba.graphar.util.{FileSystem, ChunkPartitioner, EdgeChunkPartitioner} import com.alibaba.graphar.{GeneralParams, EdgeInfo, FileType, AdjListType, PropertyGroup} import org.apache.spark.sql.SparkSession diff --git a/spark/src/main/scala/com/alibaba/graphar/writer/VertexWriter.scala b/spark/src/main/scala/com/alibaba/graphar/writer/VertexWriter.scala index 160397119..1629819ec 100644 --- a/spark/src/main/scala/com/alibaba/graphar/writer/VertexWriter.scala +++ b/spark/src/main/scala/com/alibaba/graphar/writer/VertexWriter.scala @@ -15,7 +15,7 @@ package com.alibaba.graphar.writer -import com.alibaba.graphar.utils.{FileSystem, ChunkPartitioner, IndexGenerator} +import com.alibaba.graphar.util.{FileSystem, ChunkPartitioner, IndexGenerator} import com.alibaba.graphar.{GeneralParams, VertexInfo, FileType, AdjListType, PropertyGroup} import org.apache.spark.sql.SparkSession diff --git a/spark/src/test/scala/com/alibaba/graphar/TestIndexGenerator.scala b/spark/src/test/scala/com/alibaba/graphar/TestIndexGenerator.scala index 5f71ed0b8..22754cf5f 100644 --- a/spark/src/test/scala/com/alibaba/graphar/TestIndexGenerator.scala +++ b/spark/src/test/scala/com/alibaba/graphar/TestIndexGenerator.scala @@ -15,7 +15,7 @@ package com.alibaba.graphar -import com.alibaba.graphar.utils.IndexGenerator +import com.alibaba.graphar.util.IndexGenerator import org.apache.spark.sql.{DataFrame, SparkSession} import org.scalatest.funsuite.AnyFunSuite diff --git a/spark/src/test/scala/com/alibaba/graphar/TestWriter.scala b/spark/src/test/scala/com/alibaba/graphar/TestWriter.scala index 8e281c4c4..f8f54fd14 100644 --- a/spark/src/test/scala/com/alibaba/graphar/TestWriter.scala +++ b/spark/src/test/scala/com/alibaba/graphar/TestWriter.scala @@ -16,7 +16,7 @@ package com.alibaba.graphar import com.alibaba.graphar.writer.{VertexWriter, EdgeWriter} -import com.alibaba.graphar.utils +import com.alibaba.graphar.util import org.apache.spark.sql.{DataFrame, SparkSession} import org.scalatest.funsuite.AnyFunSuite @@ -43,7 +43,7 @@ class WriterSuite extends AnyFunSuite { val vertex_info = VertexInfo.loadVertexInfo(vertex_yaml_path, spark) // generate vertex index column for vertex dataframe - val vertex_df_with_index = utils.IndexGenerator.generateVertexIndexColumn(vertex_df) + val vertex_df_with_index = util.IndexGenerator.generateVertexIndexColumn(vertex_df) // create writer object for person and generate the properties with GAR format val prefix : String = "/tmp/" @@ -60,7 +60,7 @@ class WriterSuite extends AnyFunSuite { val chunk_files = fs.globStatus(chunk_path) assert(chunk_files.length == 20) val vertex_num_path = prefix + vertex_info.getVerticesNumFilePath() - val number = utils.FileSystem.readValue(vertex_num_path, spark.sparkContext.hadoopConfiguration) + val number = util.FileSystem.readValue(vertex_num_path, spark.sparkContext.hadoopConfiguration) assert(number.toInt == vertex_df.count()) assertThrows[IllegalArgumentException](new VertexWriter(prefix, vertex_info, vertex_df)) @@ -90,7 +90,7 @@ class WriterSuite extends AnyFunSuite { val vertex_num = srcDf.union(dstDf).distinct().count() val vertex_chunk_size = edge_info.getSrc_chunk_size() val vertex_chunk_num = (vertex_num + vertex_chunk_size - 1) / vertex_chunk_size - val edge_df_with_index = utils.IndexGenerator.generateSrcAndDstIndexUnitedlyForEdges(edge_df, "src", "dst") + val edge_df_with_index = util.IndexGenerator.generateSrcAndDstIndexUnitedlyForEdges(edge_df, "src", "dst") // create writer object for person_knows_person and generate the adj list and properties with GAR format val writer = new EdgeWriter(prefix, edge_info, adj_list_type, vertex_num, edge_df_with_index) @@ -100,12 +100,12 @@ class WriterSuite extends AnyFunSuite { // validate vertex number & edge number val vertex_num_path = prefix + edge_info.getVerticesNumFilePath(adj_list_type) - val number = utils.FileSystem.readValue(vertex_num_path, spark.sparkContext.hadoopConfiguration) + val number = util.FileSystem.readValue(vertex_num_path, spark.sparkContext.hadoopConfiguration) assert(number.toInt == vertex_num) val edge_num_path_pattern = new Path(prefix + edge_info.getEdgesNumPathPrefix(adj_list_type) + "*") val edge_num_files = fs.globStatus(edge_num_path_pattern) assert(edge_num_files.length == vertex_chunk_num) - val edge_num = edge_num_files.map(file => utils.FileSystem.readValue(file.getPath().toString(), spark.sparkContext.hadoopConfiguration).toInt).sum + val edge_num = edge_num_files.map(file => util.FileSystem.readValue(file.getPath().toString(), spark.sparkContext.hadoopConfiguration).toInt).sum assert(edge_num == edge_df.count()) // validate number of chunk files @@ -166,10 +166,10 @@ class WriterSuite extends AnyFunSuite { val vertex_chunk_num = (vertex_num + vertex_chunk_size - 1) / vertex_chunk_size // construct person vertex mapping with dataframe - val vertex_mapping = utils.IndexGenerator.constructVertexIndexMapping(vertex_df, vertex_info.getPrimaryKey()) + val vertex_mapping = util.IndexGenerator.constructVertexIndexMapping(vertex_df, vertex_info.getPrimaryKey()) // generate src index and dst index for edge datafram with vertex mapping - val edge_df_with_src_index = utils.IndexGenerator.generateSrcIndexForEdgesFromMapping(edge_df, "src", vertex_mapping) - val edge_df_with_src_dst_index = utils.IndexGenerator.generateDstIndexForEdgesFromMapping(edge_df_with_src_index, "dst", vertex_mapping) + val edge_df_with_src_index = util.IndexGenerator.generateSrcIndexForEdgesFromMapping(edge_df, "src", vertex_mapping) + val edge_df_with_src_dst_index = util.IndexGenerator.generateDstIndexForEdgesFromMapping(edge_df_with_src_index, "dst", vertex_mapping) // create writer object for person_knows_person and generate the adj list and properties with GAR format val writer = new EdgeWriter(prefix, edge_info, adj_list_type, vertex_num, edge_df_with_src_dst_index) @@ -179,12 +179,12 @@ class WriterSuite extends AnyFunSuite { // validate vertex number & edge number val vertex_num_path = prefix + edge_info.getVerticesNumFilePath(adj_list_type) - val number = utils.FileSystem.readValue(vertex_num_path, spark.sparkContext.hadoopConfiguration) + val number = util.FileSystem.readValue(vertex_num_path, spark.sparkContext.hadoopConfiguration) assert(number.toInt == vertex_num) val edge_num_path_pattern = new Path(prefix + edge_info.getEdgesNumPathPrefix(adj_list_type) + "*") val edge_num_files = fs.globStatus(edge_num_path_pattern) assert(edge_num_files.length == vertex_chunk_num) - val edge_num = edge_num_files.map(file => utils.FileSystem.readValue(file.getPath().toString(), spark.sparkContext.hadoopConfiguration).toInt).sum + val edge_num = edge_num_files.map(file => util.FileSystem.readValue(file.getPath().toString(), spark.sparkContext.hadoopConfiguration).toInt).sum assert(edge_num == edge_df.count()) // validate adj list chunks diff --git a/spark/src/test/scala/com/alibaba/graphar/TransformExample.scala b/spark/src/test/scala/com/alibaba/graphar/TransformExample.scala index 8f8c21c58..b0170fa77 100644 --- a/spark/src/test/scala/com/alibaba/graphar/TransformExample.scala +++ b/spark/src/test/scala/com/alibaba/graphar/TransformExample.scala @@ -15,7 +15,7 @@ package com.alibaba.graphar -import com.alibaba.graphar.utils.IndexGenerator +import com.alibaba.graphar.util.IndexGenerator import com.alibaba.graphar.reader.{VertexReader, EdgeReader} import com.alibaba.graphar.writer.{VertexWriter, EdgeWriter} @@ -99,11 +99,11 @@ class TransformExampleSuite extends AnyFunSuite { assert(offset_chunk_files.length == 10) // validate vertex number & edge number val vertex_num_path = output_prefix + edge_info.getVerticesNumFilePath(output_adj_list_type) - val number = utils.FileSystem.readValue(vertex_num_path, spark.sparkContext.hadoopConfiguration) + val number = util.FileSystem.readValue(vertex_num_path, spark.sparkContext.hadoopConfiguration) assert(number.toInt == vertexNum) val edge_num_path_pattern = new Path(output_prefix + edge_info.getEdgesNumPathPrefix(output_adj_list_type) + "*") val edge_num_files = fs.globStatus(edge_num_path_pattern) - val tot_num = edge_num_files.map(file => utils.FileSystem.readValue(file.getPath().toString(), spark.sparkContext.hadoopConfiguration).toInt).sum + val tot_num = edge_num_files.map(file => util.FileSystem.readValue(file.getPath().toString(), spark.sparkContext.hadoopConfiguration).toInt).sum assert(tot_num == edgeNum) // clean generated files and close FileSystem instance