diff --git a/cpp/.clang-format b/.clang-format similarity index 100% rename from cpp/.clang-format rename to .clang-format diff --git a/maven-projects/java/src/main/cpp/ffi/jni_org_apache_graphar_arrow_ArrowTableStatic.cc b/maven-projects/java/src/main/cpp/ffi/jni_org_apache_graphar_arrow_ArrowTableStatic.cc index 131efbdf2..487473dd6 100644 --- a/maven-projects/java/src/main/cpp/ffi/jni_org_apache_graphar_arrow_ArrowTableStatic.cc +++ b/maven-projects/java/src/main/cpp/ffi/jni_org_apache_graphar_arrow_ArrowTableStatic.cc @@ -17,11 +17,11 @@ * under the License. */ -#include "arrow/api.h" -#include "arrow/c/bridge.h" -#include #include +#include #include +#include "arrow/api.h" +#include "arrow/c/bridge.h" #ifdef __cplusplus extern "C" { @@ -32,14 +32,14 @@ extern "C" { JNIEXPORT jlong JNICALL Java_org_apache_graphar_arrow_ArrowTable_1Static_1cxx_10x58c7409_nativeFromArrowArrayAndArrowSchema( - JNIEnv *, jclass, jlong rv_base, jlong arg0 /* arrayAddress0 */, + JNIEnv*, jclass, jlong rv_base, jlong arg0 /* arrayAddress0 */, jlong arg1 /* schemaAddress1 */) { auto maybeRecordBatch = - arrow::ImportRecordBatch(reinterpret_cast(arg0), - reinterpret_cast(arg1)); + arrow::ImportRecordBatch(reinterpret_cast(arg0), + reinterpret_cast(arg1)); auto table = arrow::Table::FromRecordBatches({maybeRecordBatch.ValueOrDie()}); return reinterpret_cast(new ( - (void *)rv_base) arrow::Result>(table)); + (void*) rv_base) arrow::Result>(table)); } #ifdef __cplusplus diff --git a/python/.clang-format b/python/.clang-format deleted file mode 100644 index 233429c9f..000000000 --- a/python/.clang-format +++ /dev/null @@ -1,33 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, 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. - -BasedOnStyle: Google -DerivePointerAlignment: false -PointerAlignment: Left -Cpp11BracedListStyle: true -IndentCaseLabels: false -AllowShortBlocksOnASingleLine: true -AllowShortLoopsOnASingleLine: false -AllowShortIfStatementsOnASingleLine: false -Standard: 'Cpp11' -SpaceAfterCStyleCast: true -AlignAfterOpenBracket: Align -SortIncludes: true -IncludeBlocks: Preserve -ForEachMacros: - - BOOST_FOREACH - diff --git a/rust/include/graphar_rs.h b/rust/include/graphar_rs.h index 42cd149bd..230cd7e1c 100644 --- a/rust/include/graphar_rs.h +++ b/rust/include/graphar_rs.h @@ -35,71 +35,70 @@ namespace graphar { using SharedPropertyGroup = std::shared_ptr; using SharedAdjacentList = std::shared_ptr; using ConstInfoVersion = const InfoVersion; -} // namespace graphar +} // namespace graphar namespace graphar_rs { -rust::String to_type_name(const graphar::DataType &type); - -std::shared_ptr -new_const_info_version(int32_t version); - -std::unique_ptr -new_property(const std::string &name, std::shared_ptr type, - bool is_primary, bool is_nullable, - graphar::Cardinality cardinality); -const std::string &property_get_name(const graphar::Property &prop); -const std::shared_ptr & -property_get_type(const graphar::Property &prop); -bool property_is_primary(const graphar::Property &prop); -bool property_is_nullable(const graphar::Property &prop); -graphar::Cardinality property_get_cardinality(const graphar::Property &prop); -std::unique_ptr -property_clone(const graphar::Property &prop); - -void property_vec_push_property(std::vector &properties, +rust::String to_type_name(const graphar::DataType& type); + +std::shared_ptr new_const_info_version( + int32_t version); + +std::unique_ptr new_property( + const std::string& name, std::shared_ptr type, + bool is_primary, bool is_nullable, graphar::Cardinality cardinality); +const std::string& property_get_name(const graphar::Property& prop); +const std::shared_ptr& property_get_type( + const graphar::Property& prop); +bool property_is_primary(const graphar::Property& prop); +bool property_is_nullable(const graphar::Property& prop); +graphar::Cardinality property_get_cardinality(const graphar::Property& prop); +std::unique_ptr property_clone( + const graphar::Property& prop); + +void property_vec_push_property(std::vector& properties, std::unique_ptr prop); -void property_vec_emplace_property(std::vector &properties, - const std::string &name, +void property_vec_emplace_property(std::vector& properties, + const std::string& name, std::shared_ptr type, bool is_primary, bool is_nullable, graphar::Cardinality cardinality); -std::unique_ptr> -property_vec_clone(const std::vector &properties); +std::unique_ptr> property_vec_clone( + const std::vector& properties); void property_group_vec_push_property_group( - std::vector &property_groups, + std::vector& property_groups, std::shared_ptr property_group); std::unique_ptr> property_group_vec_clone( - const std::vector &property_groups); + const std::vector& property_groups); std::shared_ptr create_vertex_info( - const std::string &type, graphar::IdType chunk_size, - const std::vector &property_groups, - const rust::Vec &labels, const std::string &prefix, + const std::string& type, graphar::IdType chunk_size, + const std::vector& property_groups, + const rust::Vec& labels, const std::string& prefix, std::shared_ptr version); std::shared_ptr create_edge_info( - const std::string &src_type, const std::string &edge_type, - const std::string &dst_type, graphar::IdType chunk_size, + const std::string& src_type, const std::string& edge_type, + const std::string& dst_type, graphar::IdType chunk_size, graphar::IdType src_chunk_size, graphar::IdType dst_chunk_size, - bool directed, const graphar::AdjacentListVector &adjacent_lists, - const std::vector &property_groups, - const std::string &prefix, + bool directed, const graphar::AdjacentListVector& adjacent_lists, + const std::vector& property_groups, + const std::string& prefix, std::shared_ptr version); -void vertex_info_save(const graphar::VertexInfo &vertex_info, - const std::string &path); -std::unique_ptr -vertex_info_dump(const graphar::VertexInfo &vertex_info); +void vertex_info_save(const graphar::VertexInfo& vertex_info, + const std::string& path); +std::unique_ptr vertex_info_dump( + const graphar::VertexInfo& vertex_info); std::unique_ptr new_adjacent_list_vec(); -void push_adjacent_list(graphar::AdjacentListVector &v, +void push_adjacent_list(graphar::AdjacentListVector& v, std::shared_ptr adjacent_list); -void edge_info_save(const graphar::EdgeInfo &edge_info, - const std::string &path); -std::unique_ptr edge_info_dump(const graphar::EdgeInfo &edge_info); -} // namespace graphar_rs +void edge_info_save(const graphar::EdgeInfo& edge_info, + const std::string& path); +std::unique_ptr edge_info_dump(const graphar::EdgeInfo& edge_info); +} // namespace graphar_rs diff --git a/rust/src/graphar_rs.cc b/rust/src/graphar_rs.cc index ea9791226..36c5c7da7 100644 --- a/rust/src/graphar_rs.cc +++ b/rust/src/graphar_rs.cc @@ -23,79 +23,78 @@ #include namespace graphar_rs { -rust::String to_type_name(const graphar::DataType &type) { +rust::String to_type_name(const graphar::DataType& type) { return rust::String(type.ToTypeName()); } -std::shared_ptr -new_const_info_version(int32_t version) { +std::shared_ptr new_const_info_version( + int32_t version) { // Let any upstream exceptions propagate to Rust via `cxx::Exception`. return std::make_shared(static_cast(version)); } -std::unique_ptr -new_property(const std::string &name, std::shared_ptr type, - bool is_primary, bool is_nullable, - graphar::Cardinality cardinality) { +std::unique_ptr new_property( + const std::string& name, std::shared_ptr type, + bool is_primary, bool is_nullable, graphar::Cardinality cardinality) { return std::make_unique(name, type, is_primary, is_nullable, cardinality); } -const std::string &property_get_name(const graphar::Property &prop) { +const std::string& property_get_name(const graphar::Property& prop) { return prop.name; } -const std::shared_ptr & -property_get_type(const graphar::Property &prop) { +const std::shared_ptr& property_get_type( + const graphar::Property& prop) { return prop.type; } -bool property_is_primary(const graphar::Property &prop) { +bool property_is_primary(const graphar::Property& prop) { return prop.is_primary; } -bool property_is_nullable(const graphar::Property &prop) { +bool property_is_nullable(const graphar::Property& prop) { return prop.is_nullable; } -graphar::Cardinality property_get_cardinality(const graphar::Property &prop) { +graphar::Cardinality property_get_cardinality(const graphar::Property& prop) { return prop.cardinality; } -std::unique_ptr -property_clone(const graphar::Property &prop) { +std::unique_ptr property_clone( + const graphar::Property& prop) { return std::make_unique(prop); } -void property_vec_push_property(std::vector &properties, +void property_vec_push_property(std::vector& properties, std::unique_ptr prop) { properties.emplace_back(*prop); } -void property_vec_emplace_property(std::vector &properties, - const std::string &name, +void property_vec_emplace_property(std::vector& properties, + const std::string& name, std::shared_ptr type, bool is_primary, bool is_nullable, graphar::Cardinality cardinality) { properties.emplace_back(name, type, is_primary, is_nullable, cardinality); } -std::unique_ptr> -property_vec_clone(const std::vector &properties) { +std::unique_ptr> property_vec_clone( + const std::vector& properties) { return std::make_unique>(properties); } void property_group_vec_push_property_group( - std::vector &property_groups, + std::vector& property_groups, std::shared_ptr property_group) { property_groups.emplace_back(std::move(property_group)); } std::unique_ptr> property_group_vec_clone( - const std::vector &property_groups) { + const std::vector& property_groups) { return std::make_unique>( property_groups); } std::shared_ptr create_vertex_info( - const std::string &type, graphar::IdType chunk_size, - const std::vector &property_groups, - const rust::Vec &labels, const std::string &prefix, + const std::string& type, graphar::IdType chunk_size, + const std::vector& property_groups, + const rust::Vec& labels, const std::string& prefix, std::shared_ptr version) { if (type.empty()) { throw std::runtime_error("CreateVertexInfo: type must not be empty"); @@ -119,12 +118,12 @@ std::shared_ptr create_vertex_info( } std::shared_ptr create_edge_info( - const std::string &src_type, const std::string &edge_type, - const std::string &dst_type, graphar::IdType chunk_size, + const std::string& src_type, const std::string& edge_type, + const std::string& dst_type, graphar::IdType chunk_size, graphar::IdType src_chunk_size, graphar::IdType dst_chunk_size, - bool directed, const graphar::AdjacentListVector &adjacent_lists, - const std::vector &property_groups, - const std::string &prefix, + bool directed, const graphar::AdjacentListVector& adjacent_lists, + const std::vector& property_groups, + const std::string& prefix, std::shared_ptr version) { if (src_type.empty()) { throw std::runtime_error("CreateEdgeInfo: src_type must not be empty"); @@ -158,16 +157,16 @@ std::shared_ptr create_edge_info( return edge_info; } -void vertex_info_save(const graphar::VertexInfo &vertex_info, - const std::string &path) { +void vertex_info_save(const graphar::VertexInfo& vertex_info, + const std::string& path) { auto status = vertex_info.Save(path); if (!status.ok()) { throw std::runtime_error(status.message()); } } -std::unique_ptr -vertex_info_dump(const graphar::VertexInfo &vertex_info) { +std::unique_ptr vertex_info_dump( + const graphar::VertexInfo& vertex_info) { auto dumped = vertex_info.Dump(); if (!dumped) { throw std::runtime_error(dumped.error().message()); @@ -179,25 +178,25 @@ std::unique_ptr new_adjacent_list_vec() { return std::make_unique(); } -void push_adjacent_list(graphar::AdjacentListVector &v, +void push_adjacent_list(graphar::AdjacentListVector& v, std::shared_ptr adjacent_list) { v.emplace_back(std::move(adjacent_list)); } -void edge_info_save(const graphar::EdgeInfo &edge_info, - const std::string &path) { +void edge_info_save(const graphar::EdgeInfo& edge_info, + const std::string& path) { auto status = edge_info.Save(path); if (!status.ok()) { throw std::runtime_error(status.message()); } } -std::unique_ptr -edge_info_dump(const graphar::EdgeInfo &edge_info) { +std::unique_ptr edge_info_dump( + const graphar::EdgeInfo& edge_info) { auto r = edge_info.Dump(); if (!r) { throw std::runtime_error(r.error().message()); } return std::make_unique(std::move(r).value()); } -} // namespace graphar_rs +} // namespace graphar_rs