This is an automated email from the ASF dual-hosted git repository.
xiaokang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-graphar.git
The following commit(s) were added to refs/heads/main by this push:
new 6e72a884 feat(format): remove duplicate .clang-format and move it to
top layer (#850)
6e72a884 is described below
commit 6e72a884e933bea68af1e8f0c9b49f59e60452e5
Author: Jason <[email protected]>
AuthorDate: Tue Feb 24 10:02:13 2026 +0800
feat(format): remove duplicate .clang-format and move it to top layer (#850)
* feat: remove duplicate .clang-format and move it to top layer
* fix(C++): fix remaining unformatted cpp code which are not included in
cpp directory
---
cpp/.clang-format => .clang-format | 0
...ni_org_apache_graphar_arrow_ArrowTableStatic.cc | 14 ++--
python/.clang-format | 33 ---------
rust/include/graphar_rs.h | 85 +++++++++++-----------
rust/src/graphar_rs.cc | 79 ++++++++++----------
5 files changed, 88 insertions(+), 123 deletions(-)
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 131efbdf..487473dd 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 <iostream>
#include <jni.h>
+#include <iostream>
#include <new>
+#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<struct ArrowArray *>(arg0),
- reinterpret_cast<struct ArrowSchema *>(arg1));
+ arrow::ImportRecordBatch(reinterpret_cast<struct ArrowArray*>(arg0),
+ reinterpret_cast<struct ArrowSchema*>(arg1));
auto table =
arrow::Table::FromRecordBatches({maybeRecordBatch.ValueOrDie()});
return reinterpret_cast<jlong>(new (
- (void *)rv_base) arrow::Result<std::shared_ptr<arrow::Table>>(table));
+ (void*) rv_base) arrow::Result<std::shared_ptr<arrow::Table>>(table));
}
#ifdef __cplusplus
diff --git a/python/.clang-format b/python/.clang-format
deleted file mode 100644
index 233429c9..00000000
--- 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 42cd149b..230cd7e1 100644
--- a/rust/include/graphar_rs.h
+++ b/rust/include/graphar_rs.h
@@ -35,71 +35,70 @@ namespace graphar {
using SharedPropertyGroup = std::shared_ptr<PropertyGroup>;
using SharedAdjacentList = std::shared_ptr<AdjacentList>;
using ConstInfoVersion = const InfoVersion;
-} // namespace graphar
+} // namespace graphar
namespace graphar_rs {
-rust::String to_type_name(const graphar::DataType &type);
-
-std::shared_ptr<graphar::ConstInfoVersion>
-new_const_info_version(int32_t version);
-
-std::unique_ptr<graphar::Property>
-new_property(const std::string &name, std::shared_ptr<graphar::DataType> type,
- bool is_primary, bool is_nullable,
- graphar::Cardinality cardinality);
-const std::string &property_get_name(const graphar::Property &prop);
-const std::shared_ptr<graphar::DataType> &
-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<graphar::Property>
-property_clone(const graphar::Property &prop);
-
-void property_vec_push_property(std::vector<graphar::Property> &properties,
+rust::String to_type_name(const graphar::DataType& type);
+
+std::shared_ptr<graphar::ConstInfoVersion> new_const_info_version(
+ int32_t version);
+
+std::unique_ptr<graphar::Property> new_property(
+ const std::string& name, std::shared_ptr<graphar::DataType> type,
+ bool is_primary, bool is_nullable, graphar::Cardinality cardinality);
+const std::string& property_get_name(const graphar::Property& prop);
+const std::shared_ptr<graphar::DataType>& 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<graphar::Property> property_clone(
+ const graphar::Property& prop);
+
+void property_vec_push_property(std::vector<graphar::Property>& properties,
std::unique_ptr<graphar::Property> prop);
-void property_vec_emplace_property(std::vector<graphar::Property> &properties,
- const std::string &name,
+void property_vec_emplace_property(std::vector<graphar::Property>& properties,
+ const std::string& name,
std::shared_ptr<graphar::DataType> type,
bool is_primary, bool is_nullable,
graphar::Cardinality cardinality);
-std::unique_ptr<std::vector<graphar::Property>>
-property_vec_clone(const std::vector<graphar::Property> &properties);
+std::unique_ptr<std::vector<graphar::Property>> property_vec_clone(
+ const std::vector<graphar::Property>& properties);
void property_group_vec_push_property_group(
- std::vector<graphar::SharedPropertyGroup> &property_groups,
+ std::vector<graphar::SharedPropertyGroup>& property_groups,
std::shared_ptr<graphar::PropertyGroup> property_group);
std::unique_ptr<std::vector<graphar::SharedPropertyGroup>>
property_group_vec_clone(
- const std::vector<graphar::SharedPropertyGroup> &property_groups);
+ const std::vector<graphar::SharedPropertyGroup>& property_groups);
std::shared_ptr<graphar::VertexInfo> create_vertex_info(
- const std::string &type, graphar::IdType chunk_size,
- const std::vector<graphar::SharedPropertyGroup> &property_groups,
- const rust::Vec<rust::String> &labels, const std::string &prefix,
+ const std::string& type, graphar::IdType chunk_size,
+ const std::vector<graphar::SharedPropertyGroup>& property_groups,
+ const rust::Vec<rust::String>& labels, const std::string& prefix,
std::shared_ptr<graphar::ConstInfoVersion> version);
std::shared_ptr<graphar::EdgeInfo> 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<graphar::SharedPropertyGroup> &property_groups,
- const std::string &prefix,
+ bool directed, const graphar::AdjacentListVector& adjacent_lists,
+ const std::vector<graphar::SharedPropertyGroup>& property_groups,
+ const std::string& prefix,
std::shared_ptr<graphar::ConstInfoVersion> version);
-void vertex_info_save(const graphar::VertexInfo &vertex_info,
- const std::string &path);
-std::unique_ptr<std::string>
-vertex_info_dump(const graphar::VertexInfo &vertex_info);
+void vertex_info_save(const graphar::VertexInfo& vertex_info,
+ const std::string& path);
+std::unique_ptr<std::string> vertex_info_dump(
+ const graphar::VertexInfo& vertex_info);
std::unique_ptr<graphar::AdjacentListVector> new_adjacent_list_vec();
-void push_adjacent_list(graphar::AdjacentListVector &v,
+void push_adjacent_list(graphar::AdjacentListVector& v,
std::shared_ptr<graphar::AdjacentList> adjacent_list);
-void edge_info_save(const graphar::EdgeInfo &edge_info,
- const std::string &path);
-std::unique_ptr<std::string> 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<std::string> 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 ea979122..36c5c7da 100644
--- a/rust/src/graphar_rs.cc
+++ b/rust/src/graphar_rs.cc
@@ -23,79 +23,78 @@
#include <utility>
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<graphar::ConstInfoVersion>
-new_const_info_version(int32_t version) {
+std::shared_ptr<graphar::ConstInfoVersion> new_const_info_version(
+ int32_t version) {
// Let any upstream exceptions propagate to Rust via `cxx::Exception`.
return std::make_shared<graphar::InfoVersion>(static_cast<int>(version));
}
-std::unique_ptr<graphar::Property>
-new_property(const std::string &name, std::shared_ptr<graphar::DataType> type,
- bool is_primary, bool is_nullable,
- graphar::Cardinality cardinality) {
+std::unique_ptr<graphar::Property> new_property(
+ const std::string& name, std::shared_ptr<graphar::DataType> type,
+ bool is_primary, bool is_nullable, graphar::Cardinality cardinality) {
return std::make_unique<graphar::Property>(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<graphar::DataType> &
-property_get_type(const graphar::Property &prop) {
+const std::shared_ptr<graphar::DataType>& 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<graphar::Property>
-property_clone(const graphar::Property &prop) {
+std::unique_ptr<graphar::Property> property_clone(
+ const graphar::Property& prop) {
return std::make_unique<graphar::Property>(prop);
}
-void property_vec_push_property(std::vector<graphar::Property> &properties,
+void property_vec_push_property(std::vector<graphar::Property>& properties,
std::unique_ptr<graphar::Property> prop) {
properties.emplace_back(*prop);
}
-void property_vec_emplace_property(std::vector<graphar::Property> &properties,
- const std::string &name,
+void property_vec_emplace_property(std::vector<graphar::Property>& properties,
+ const std::string& name,
std::shared_ptr<graphar::DataType> type,
bool is_primary, bool is_nullable,
graphar::Cardinality cardinality) {
properties.emplace_back(name, type, is_primary, is_nullable, cardinality);
}
-std::unique_ptr<std::vector<graphar::Property>>
-property_vec_clone(const std::vector<graphar::Property> &properties) {
+std::unique_ptr<std::vector<graphar::Property>> property_vec_clone(
+ const std::vector<graphar::Property>& properties) {
return std::make_unique<std::vector<graphar::Property>>(properties);
}
void property_group_vec_push_property_group(
- std::vector<graphar::SharedPropertyGroup> &property_groups,
+ std::vector<graphar::SharedPropertyGroup>& property_groups,
std::shared_ptr<graphar::PropertyGroup> property_group) {
property_groups.emplace_back(std::move(property_group));
}
std::unique_ptr<std::vector<graphar::SharedPropertyGroup>>
property_group_vec_clone(
- const std::vector<graphar::SharedPropertyGroup> &property_groups) {
+ const std::vector<graphar::SharedPropertyGroup>& property_groups) {
return std::make_unique<std::vector<graphar::SharedPropertyGroup>>(
property_groups);
}
std::shared_ptr<graphar::VertexInfo> create_vertex_info(
- const std::string &type, graphar::IdType chunk_size,
- const std::vector<graphar::SharedPropertyGroup> &property_groups,
- const rust::Vec<rust::String> &labels, const std::string &prefix,
+ const std::string& type, graphar::IdType chunk_size,
+ const std::vector<graphar::SharedPropertyGroup>& property_groups,
+ const rust::Vec<rust::String>& labels, const std::string& prefix,
std::shared_ptr<graphar::ConstInfoVersion> version) {
if (type.empty()) {
throw std::runtime_error("CreateVertexInfo: type must not be empty");
@@ -119,12 +118,12 @@ std::shared_ptr<graphar::VertexInfo> create_vertex_info(
}
std::shared_ptr<graphar::EdgeInfo> 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<graphar::SharedPropertyGroup> &property_groups,
- const std::string &prefix,
+ bool directed, const graphar::AdjacentListVector& adjacent_lists,
+ const std::vector<graphar::SharedPropertyGroup>& property_groups,
+ const std::string& prefix,
std::shared_ptr<graphar::ConstInfoVersion> version) {
if (src_type.empty()) {
throw std::runtime_error("CreateEdgeInfo: src_type must not be empty");
@@ -158,16 +157,16 @@ std::shared_ptr<graphar::EdgeInfo> 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<std::string>
-vertex_info_dump(const graphar::VertexInfo &vertex_info) {
+std::unique_ptr<std::string> 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<graphar::AdjacentListVector>
new_adjacent_list_vec() {
return std::make_unique<graphar::AdjacentListVector>();
}
-void push_adjacent_list(graphar::AdjacentListVector &v,
+void push_adjacent_list(graphar::AdjacentListVector& v,
std::shared_ptr<graphar::AdjacentList> 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<std::string>
-edge_info_dump(const graphar::EdgeInfo &edge_info) {
+std::unique_ptr<std::string> 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::string>(std::move(r).value());
}
-} // namespace graphar_rs
+} // namespace graphar_rs
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]