From 70f10620e610277d2daac345796b8ccbd81bcb86 Mon Sep 17 00:00:00 2001 From: AntoinePrv Date: Tue, 22 Jul 2025 16:24:40 +0200 Subject: [PATCH 1/5] Update clang-format --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 186277edf40..8dfce731c0e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,7 +50,7 @@ repos: ) types: [] - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v14.0.6 + rev: v20.1.8 hooks: - id: clang-format name: C++ Format @@ -93,7 +93,7 @@ repos: ?^cpp/thirdparty/| ) - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v14.0.6 + rev: v20.1.8 hooks: - id: clang-format alias: c-glib @@ -101,7 +101,7 @@ repos: files: >- ^c_glib/ - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v14.0.6 + rev: v20.1.8 hooks: - id: clang-format name: MATLAB (C++) Format @@ -156,7 +156,7 @@ repos: files: >- ^python/ - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v14.0.6 + rev: v20.1.8 hooks: - id: clang-format alias: python @@ -213,7 +213,7 @@ repos: files: >- ^r/.*\.R$ - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v14.0.6 + rev: v20.1.8 hooks: - id: clang-format alias: r From f6a338c8fc1b394788d02580f01b31c8d8b4bda7 Mon Sep 17 00:00:00 2001 From: AntoinePrv Date: Tue, 22 Jul 2025 16:49:18 +0200 Subject: [PATCH 2/5] Format with clang-format 20 --- cpp/src/arrow/c/bridge.cc | 2 +- cpp/src/arrow/c/bridge_test.cc | 38 +++++++-------- .../arrow/compute/kernels/aggregate_test.cc | 3 +- cpp/src/arrow/compute/kernels/scalar_round.cc | 9 ++-- .../compute/kernels/scalar_temporal_binary.cc | 10 ++-- .../compute/kernels/scalar_temporal_unary.cc | 10 ++-- .../vector_selection_filter_internal.cc | 2 +- cpp/src/arrow/dataset/dataset_writer_test.cc | 8 ++-- cpp/src/arrow/dataset/file_test.cc | 11 +++-- cpp/src/arrow/dataset/scanner.cc | 2 +- cpp/src/arrow/engine/substrait/serde_test.cc | 12 ++--- .../arrow/flight/serialization_internal.cc | 2 +- cpp/src/arrow/gpu/cuda_test.cc | 4 +- cpp/src/arrow/io/memory_test.cc | 6 +-- cpp/src/arrow/json/test_common.h | 2 +- cpp/src/arrow/util/async_generator.h | 5 +- cpp/src/arrow/util/bit_util_benchmark.cc | 5 +- .../arrow/util/byte_stream_split_internal.cc | 28 +++++------ cpp/src/arrow/util/cpu_info.cc | 48 ++++++++----------- cpp/src/arrow/util/hashing.h | 9 ++-- cpp/src/arrow/util/reflection_internal.h | 8 ++-- cpp/src/arrow/util/thread_pool.cc | 4 +- cpp/src/arrow/util/tracing.cc | 3 +- cpp/src/arrow/util/value_parsing_test.cc | 12 ++--- cpp/src/gandiva/encrypt_utils_test.cc | 10 ++-- cpp/src/gandiva/gdv_hash_function_stubs.cc | 2 +- cpp/src/gandiva/gdv_string_function_stubs.cc | 4 +- .../gandiva/precompiled/string_ops_test.cc | 6 +-- cpp/src/parquet/types.cc | 6 ++- 29 files changed, 128 insertions(+), 143 deletions(-) diff --git a/cpp/src/arrow/c/bridge.cc b/cpp/src/arrow/c/bridge.cc index dd25ed299dd..c61ee86d538 100644 --- a/cpp/src/arrow/c/bridge.cc +++ b/cpp/src/arrow/c/bridge.cc @@ -533,7 +533,7 @@ namespace { struct ExportedArrayPrivateData : PoolAllocationMixin { // The buffers are owned by the ArrayData member SmallVector buffers_; - struct ArrowArray dictionary_ {}; + struct ArrowArray dictionary_{}; SmallVector children_; SmallVector child_pointers_; diff --git a/cpp/src/arrow/c/bridge_test.cc b/cpp/src/arrow/c/bridge_test.cc index c6a5e01e038..3baaef91693 100644 --- a/cpp/src/arrow/c/bridge_test.cc +++ b/cpp/src/arrow/c/bridge_test.cc @@ -1226,8 +1226,8 @@ TEST_F(TestArrayExport, MoveSeveralChildren) { } TEST_F(TestArrayExport, ExportArrayAndType) { - struct ArrowSchema c_schema {}; - struct ArrowArray c_array {}; + struct ArrowSchema c_schema{}; + struct ArrowArray c_array{}; SchemaExportGuard schema_guard(&c_schema); ArrayExportGuard array_guard(&c_array); @@ -1244,8 +1244,8 @@ TEST_F(TestArrayExport, ExportArrayAndType) { } TEST_F(TestArrayExport, ExportRecordBatch) { - struct ArrowSchema c_schema {}; - struct ArrowArray c_array {}; + struct ArrowSchema c_schema{}; + struct ArrowArray c_array{}; auto schema = ::arrow::schema( {field("ints", int16()), field("bools", boolean(), /*nullable=*/false)}); @@ -1704,8 +1704,8 @@ TEST_F(TestDeviceArrayExport, ExportArrayAndType) { std::shared_ptr device = std::make_shared(1); auto mm = device->default_memory_manager(); - struct ArrowSchema c_schema {}; - struct ArrowDeviceArray c_array {}; + struct ArrowSchema c_schema{}; + struct ArrowDeviceArray c_array{}; SchemaExportGuard schema_guard(&c_schema); ArrayExportGuard array_guard(&c_array.array); @@ -1726,8 +1726,8 @@ TEST_F(TestDeviceArrayExport, ExportRecordBatch) { std::shared_ptr device = std::make_shared(1); auto mm = device->default_memory_manager(); - struct ArrowSchema c_schema {}; - struct ArrowDeviceArray c_array {}; + struct ArrowSchema c_schema{}; + struct ArrowDeviceArray c_array{}; auto schema = ::arrow::schema( {field("ints", int16()), field("bools", boolean(), /*nullable=*/false)}); @@ -3619,7 +3619,7 @@ class TestSchemaRoundtrip : public ::testing::Test { void TestWithTypeFactory(TypeFactory&& factory, ExpectedTypeFactory&& factory_expected) { std::shared_ptr type, actual; - struct ArrowSchema c_schema {}; // zeroed + struct ArrowSchema c_schema{}; // zeroed SchemaExportGuard schema_guard(&c_schema); auto orig_bytes = pool_->bytes_allocated(); @@ -3650,7 +3650,7 @@ class TestSchemaRoundtrip : public ::testing::Test { template void TestWithSchemaFactory(SchemaFactory&& factory) { std::shared_ptr schema, actual; - struct ArrowSchema c_schema {}; // zeroed + struct ArrowSchema c_schema{}; // zeroed SchemaExportGuard schema_guard(&c_schema); auto orig_bytes = pool_->bytes_allocated(); @@ -3865,8 +3865,8 @@ class TestArrayRoundtrip : public ::testing::Test { void TestWithArrayFactory(ArrayFactory&& factory, ExpectedArrayFactory&& factory_expected) { std::shared_ptr array; - struct ArrowArray c_array {}; - struct ArrowSchema c_schema {}; + struct ArrowArray c_array{}; + struct ArrowSchema c_schema{}; ArrayExportGuard array_guard(&c_array); SchemaExportGuard schema_guard(&c_schema); @@ -3910,8 +3910,8 @@ class TestArrayRoundtrip : public ::testing::Test { template void TestWithBatchFactory(BatchFactory&& factory) { std::shared_ptr batch; - struct ArrowArray c_array {}; - struct ArrowSchema c_schema {}; + struct ArrowArray c_array{}; + struct ArrowSchema c_schema{}; ArrayExportGuard array_guard(&c_array); SchemaExportGuard schema_guard(&c_schema); @@ -4184,7 +4184,7 @@ TEST_F(TestArrayRoundtrip, RegisteredExtensionNoMetadata) { KeyValueMetadata::Make({"ARROW:extension:name"}, {ext_type->extension_name()}); auto ext_field = field("", ext_type->storage_type(), true, std::move(ext_metadata)); - struct ArrowSchema c_schema {}; + struct ArrowSchema c_schema{}; SchemaExportGuard schema_guard(&c_schema); ASSERT_OK(ExportField(*ext_field, &c_schema)); @@ -4305,8 +4305,8 @@ class TestDeviceArrayRoundtrip : public ::testing::Test { void TestWithArrayFactory(ArrayFactory&& factory, ExpectedArrayFactory&& factory_expected) { std::shared_ptr array; - struct ArrowDeviceArray c_array {}; - struct ArrowSchema c_schema {}; + struct ArrowDeviceArray c_array{}; + struct ArrowSchema c_schema{}; ArrayExportGuard array_guard(&c_array.array); SchemaExportGuard schema_guard(&c_schema); @@ -4354,8 +4354,8 @@ class TestDeviceArrayRoundtrip : public ::testing::Test { auto mm = device->default_memory_manager(); std::shared_ptr batch; - struct ArrowDeviceArray c_array {}; - struct ArrowSchema c_schema {}; + struct ArrowDeviceArray c_array{}; + struct ArrowSchema c_schema{}; ArrayExportGuard array_guard(&c_array.array); SchemaExportGuard schema_guard(&c_schema); diff --git a/cpp/src/arrow/compute/kernels/aggregate_test.cc b/cpp/src/arrow/compute/kernels/aggregate_test.cc index cdc62f946a9..c5ba012d767 100644 --- a/cpp/src/arrow/compute/kernels/aggregate_test.cc +++ b/cpp/src/arrow/compute/kernels/aggregate_test.cc @@ -3889,8 +3889,7 @@ class TestPrimitiveQuantileKernel : public ::testing::Test { #define INTYPE(x) Datum(static_cast(x)) #define DOUBLE(x) Datum(static_cast(x)) // output type per interpolation: linear, lower, higher, nearest, midpoint -#define O(a, b, c, d, e) \ - { DOUBLE(a), INTYPE(b), INTYPE(c), INTYPE(d), DOUBLE(e) } +#define O(a, b, c, d, e) {DOUBLE(a), INTYPE(b), INTYPE(c), INTYPE(d), DOUBLE(e)} template class TestIntegerQuantileKernel : public TestPrimitiveQuantileKernel {}; diff --git a/cpp/src/arrow/compute/kernels/scalar_round.cc b/cpp/src/arrow/compute/kernels/scalar_round.cc index 208b9875a1c..41756d83f82 100644 --- a/cpp/src/arrow/compute/kernels/scalar_round.cc +++ b/cpp/src/arrow/compute/kernels/scalar_round.cc @@ -1227,11 +1227,10 @@ Status FixedRoundDecimalExec(KernelContext* ctx, const ExecSpan& batch, ExecResu // ---------------------------------------------------------------------- // Begin round kernel generation and function registration -template < - template class Op, - template typename> - class Kernel, - typename OptionsType> +template