Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ repos:
)
types: []
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6
rev: v18.1.8
hooks:
- id: clang-format
name: C++ Format
Expand Down Expand Up @@ -93,15 +93,15 @@ repos:
?^cpp/thirdparty/|
)
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6
rev: v18.1.8
hooks:
- id: clang-format
alias: c-glib
name: C/GLib Format
files: >-
^c_glib/
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6
rev: v18.1.8
hooks:
- id: clang-format
name: MATLAB (C++) Format
Expand Down Expand Up @@ -156,7 +156,7 @@ repos:
files: >-
^python/
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6
rev: v18.1.8
hooks:
- id: clang-format
alias: python
Expand Down Expand Up @@ -213,7 +213,7 @@ repos:
files: >-
^r/.*\.R$
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6
rev: v18.1.8
hooks:
- id: clang-format
alias: r
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/acero/exec_plan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ struct ExecPlanImpl : public ExecPlan {
opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span> span =
::arrow::internal::tracing::UnwrapSpan(span_.details.get());
std::for_each(std::begin(pairs), std::end(pairs),
[span](std::pair<std::string, std::string> const& pair) {
[span](const std::pair<std::string, std::string>& pair) {
span->SetAttribute(pair.first, pair.second);
});
}
Expand Down
3 changes: 1 addition & 2 deletions cpp/src/arrow/compute/kernels/aggregate_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3889,8 +3889,7 @@ class TestPrimitiveQuantileKernel : public ::testing::Test {
#define INTYPE(x) Datum(static_cast<typename TypeParam::c_type>(x))
#define DOUBLE(x) Datum(static_cast<double>(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 <typename ArrowType>
class TestIntegerQuantileKernel : public TestPrimitiveQuantileKernel<ArrowType> {};
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/compute/kernels/hash_aggregate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ concept CFloatingPointConcept = std::floating_point<T> || std::same_as<T, util::

template <typename T>
concept CDecimalConcept = std::same_as<T, Decimal32> || std::same_as<T, Decimal64> ||
std::same_as<T, Decimal128> || std::same_as<T, Decimal256>;
std::same_as<T, Decimal128> || std::same_as<T, Decimal256>;

template <typename CType>
struct AntiExtrema {
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/compute/kernels/temporal_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ using std::chrono::duration_cast;
using ArrowTimeZone = std::variant<const time_zone*, OffsetZone>;

template <class Duration, class Func>
auto ApplyTimeZone(const ArrowTimeZone& tz, sys_time<Duration> st, Func&& func)
-> decltype(func(zoned_time<Duration>{})) {
auto ApplyTimeZone(const ArrowTimeZone& tz, sys_time<Duration> st,
Func&& func) -> decltype(func(zoned_time<Duration>{})) {
return std::visit(
[&](auto&& zone) {
if constexpr (std::is_pointer_v<std::decay_t<decltype(zone)> >) {
Expand All @@ -60,8 +60,8 @@ auto ApplyTimeZone(const ArrowTimeZone& tz, sys_time<Duration> st, Func&& func)

template <class Duration, class Func>
auto ApplyTimeZone(const ArrowTimeZone& tz, local_time<Duration> lt,
std::optional<choose> c, Func&& func)
-> decltype(func(zoned_time<Duration>{})) {
std::optional<choose> c,
Func&& func) -> decltype(func(zoned_time<Duration>{})) {
return std::visit(
[&](auto&& zone) {
if constexpr (std::is_pointer_v<std::decay_t<decltype(zone)> >) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class PrimitiveFilterImpl {
}
}
} // !filter_block.AllSet()
} // while(in_position < values_length_)
} // while(in_position < values_length_)
}

// Write the next out_position given the selected in_position for the input
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/compute/kernels/vector_sort_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ std::ostream& operator<<(std::ostream& os, NullPlacement null_placement) {
// Tests for NthToIndices

template <typename ArrayType>
auto GetLogicalValue(const ArrayType& array, uint64_t index)
-> decltype(array.GetView(index)) {
auto GetLogicalValue(const ArrayType& array,
uint64_t index) -> decltype(array.GetView(index)) {
return array.GetView(index);
}

Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/dataset/dataset_writer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,8 @@ TEST_F(DatasetWriterTestFixture, ErrOnExistingData) {
fs::File("testdir/chunk-5.arrow"), fs::File("testdir/blah.txt")}));
filesystem_ = std::dynamic_pointer_cast<MockFileSystem>(fs);
write_options_.filesystem = filesystem_;
ASSERT_RAISES(Invalid, DatasetWriter::Make(
write_options_, scheduler_, [] {}, [] {}, [] {}));
ASSERT_RAISES(Invalid,
DatasetWriter::Make(write_options_, scheduler_, [] {}, [] {}, [] {}));
AssertEmptyFiles(
{"testdir/chunk-0.arrow", "testdir/chunk-5.arrow", "testdir/blah.txt"});

Expand All @@ -627,8 +627,8 @@ TEST_F(DatasetWriterTestFixture, ErrOnExistingData) {
filesystem_ = std::dynamic_pointer_cast<MockFileSystem>(fs2);
write_options_.filesystem = filesystem_;
write_options_.base_dir = "testdir";
ASSERT_RAISES(Invalid, DatasetWriter::Make(
write_options_, scheduler_, [] {}, [] {}, [] {}));
ASSERT_RAISES(Invalid,
DatasetWriter::Make(write_options_, scheduler_, [] {}, [] {}, [] {}));
AssertEmptyFiles({"testdir/part-0.arrow"});
}

Expand Down
11 changes: 6 additions & 5 deletions cpp/src/arrow/dataset/file_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,12 @@ class FileSystemWriteTest : public testing::TestWithParam<std::tuple<bool, bool>
};

TEST_P(FileSystemWriteTest, Write) {
auto plan_factory = [](const FileSystemDatasetWriteOptions& write_options,
std::function<Future<std::optional<cp::ExecBatch>>()>*
sink_gen) {
return std::vector<acero::Declaration>{{"write", WriteNodeOptions{write_options}}};
};
auto plan_factory =
[](const FileSystemDatasetWriteOptions& write_options,
std::function<Future<std::optional<cp::ExecBatch>>()>* sink_gen) {
return std::vector<acero::Declaration>{
{"write", WriteNodeOptions{write_options}}};
};
TestDatasetWriteRoundTrip(plan_factory, /*has_output=*/false);
}

Expand Down
3 changes: 1 addition & 2 deletions cpp/src/arrow/device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ Result<std::shared_ptr<Device::SyncEvent>> MemoryManager::WrapDeviceSyncEvent(
return nullptr;
}

Device::~Device() {}

Device::~Device(){}
#define COPY_BUFFER_SUCCESS(maybe_buffer) \
((maybe_buffer).ok() && *(maybe_buffer) != nullptr)

Expand Down
12 changes: 6 additions & 6 deletions cpp/src/arrow/engine/substrait/serde_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1229,9 +1229,9 @@ TEST(Substrait, ExtensionSetFromPlan) {
{std::shared_ptr<ExtensionIdRegistry>(), MakeExtensionIdRegistry()}) {
ExtensionIdRegistry* ext_id_reg = sp_ext_id_reg.get();
ExtensionSet ext_set(ext_id_reg);
ASSERT_OK_AND_ASSIGN(auto sink_decls,
DeserializePlans(
*buf, [] { return kNullConsumer; }, ext_id_reg, &ext_set));
ASSERT_OK_AND_ASSIGN(
auto sink_decls,
DeserializePlans(*buf, [] { return kNullConsumer; }, ext_id_reg, &ext_set));

EXPECT_OK_AND_ASSIGN(auto decoded_null_type, ext_set.DecodeType(42));
EXPECT_EQ(decoded_null_type.id.uri, kArrowExtTypesUri);
Expand Down Expand Up @@ -1665,9 +1665,9 @@ TEST(Substrait, JoinPlanBasic) {
{std::shared_ptr<ExtensionIdRegistry>(), MakeExtensionIdRegistry()}) {
ExtensionIdRegistry* ext_id_reg = sp_ext_id_reg.get();
ExtensionSet ext_set(ext_id_reg);
ASSERT_OK_AND_ASSIGN(auto sink_decls,
DeserializePlans(
*buf, [] { return kNullConsumer; }, ext_id_reg, &ext_set));
ASSERT_OK_AND_ASSIGN(
auto sink_decls,
DeserializePlans(*buf, [] { return kNullConsumer; }, ext_id_reg, &ext_set));

auto join_decl = sink_decls[0].inputs[0];

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/flight/serialization_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct overloaded : Ts... {
using Ts::operator()...;
};
template <class... Ts> // CTAD will not be needed for >=C++20
overloaded(Ts...)->overloaded<Ts...>;
overloaded(Ts...) -> overloaded<Ts...>;

namespace arrow {
namespace flight {
Expand Down
6 changes: 2 additions & 4 deletions cpp/src/arrow/io/memory_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,7 @@ class TestTransformInputStream : public ::testing::Test {
auto stream = std::make_shared<TransformInputStream>(
std::make_shared<BufferReader>(src), this->transform());
std::shared_ptr<Buffer> actual;
AccumulateReads(
stream, [&]() -> int64_t { return chunk_sizes(gen); }, &actual);
AccumulateReads(stream, [&]() -> int64_t { return chunk_sizes(gen); }, &actual);
AssertBufferEqual(*actual, *expected);
}

Expand Down Expand Up @@ -613,8 +612,7 @@ class TestTransformInputStream : public ::testing::Test {

void AccumulateReads(const std::shared_ptr<InputStream>& stream, int64_t chunk_size,
std::shared_ptr<Buffer>* out) {
return AccumulateReads(
stream, [=]() { return chunk_size; }, out);
return AccumulateReads(stream, [=]() { return chunk_size; }, out);
}

protected:
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/json/test_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct GenerateImpl {
Status Visit(const NullType&) { return OK(writer.Null()); }

Status Visit(const BooleanType&) {
return OK(writer.Bool(std::uniform_int_distribution<uint16_t>{}(e)&1));
return OK(writer.Bool(std::uniform_int_distribution<uint16_t>{}(e) & 1));
}

template <typename T>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/scalar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ struct ScalarValidateImpl {
};

template <typename T, size_t N>
void FillScalarScratchSpace(void* scratch_space, T const (&arr)[N]) {
void FillScalarScratchSpace(void* scratch_space, const T (&arr)[N]) {
static_assert(sizeof(arr) <= internal::kScalarScratchSpaceSize);
std::memcpy(scratch_space, arr, sizeof(arr));
}
Expand Down
5 changes: 2 additions & 3 deletions cpp/src/arrow/util/async_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -1439,9 +1439,8 @@ class MergedGenerator {
immediate_inner(next_item.result());
if (immediate_inner.was_empty) {
Future<AsyncGenerator<T>> next_source = state->PullSource();
if (next_source.TryAddCallback([this] {
return OuterCallback{state, index};
})) {
if (next_source.TryAddCallback(
[this] { return OuterCallback{state, index}; })) {
// We hit an unfinished future so we can stop looping
return;
}
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/arrow/util/bpacking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ struct UnpackDynamicFunction {
using Implementation = std::pair<DispatchLevel, FunctionType>;

static constexpr auto implementations() {
return std::array {
// Current SIMD unpack algorithm works terribly on SSE4.2 due to lack of variable
// rhsift and poor xsimd fallback.
Implementation{DispatchLevel::NONE, &unpack_scalar<Uint>},
return std::array{
// Current SIMD unpack algorithm works terribly on SSE4.2 due to lack of variable
// rhsift and poor xsimd fallback.
Implementation{DispatchLevel::NONE, &unpack_scalar<Uint>},
#if defined(ARROW_HAVE_RUNTIME_AVX2)
Implementation{DispatchLevel::AVX2, &unpack_avx2<Uint>},
Implementation{DispatchLevel::AVX2, &unpack_avx2<Uint>},
#endif
#if defined(ARROW_HAVE_RUNTIME_AVX512)
Implementation{DispatchLevel::AVX512, &unpack_avx512<Uint>},
Implementation{DispatchLevel::AVX512, &unpack_avx512<Uint>},
#endif
};
}
Expand Down
28 changes: 13 additions & 15 deletions cpp/src/arrow/util/byte_stream_split_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ struct ByteStreamSplitDecodeDynamic {
using Implementation = std::pair<DispatchLevel, FunctionType>;

constexpr static auto implementations() {
return std::array {
Implementation {
DispatchLevel::NONE,
return std::array{
Implementation{
DispatchLevel::NONE,
#if defined(ARROW_HAVE_NEON)
// We always expect Neon to be available on Arm64
&ByteStreamSplitDecodeSimd<xsimd::neon64, kNumStreams>,
Expand All @@ -47,13 +47,12 @@ struct ByteStreamSplitDecodeDynamic {
#else
&ByteStreamSplitDecodeScalar<kNumStreams>,
#endif
}
,
},
#if defined(ARROW_HAVE_RUNTIME_AVX2)
Implementation{
DispatchLevel::AVX2,
&ByteStreamSplitDecodeSimd<xsimd::avx2, kNumStreams>,
},
Implementation{
DispatchLevel::AVX2,
&ByteStreamSplitDecodeSimd<xsimd::avx2, kNumStreams>,
},
#endif
};
}
Expand Down Expand Up @@ -83,9 +82,9 @@ struct ByteStreamSplitEncodeDynamic {
using Implementation = std::pair<DispatchLevel, FunctionType>;

constexpr static auto implementations() {
return std::array {
Implementation {
DispatchLevel::NONE,
return std::array{
Implementation{
DispatchLevel::NONE,
#if defined(ARROW_HAVE_NEON)
// We always expect Neon to be available on Arm64
&ByteStreamSplitEncodeSimd<xsimd::neon64, kNumStreams>,
Expand All @@ -95,10 +94,9 @@ struct ByteStreamSplitEncodeDynamic {
#else
&ByteStreamSplitEncodeScalar<kNumStreams>,
#endif
}
,
},
#if defined(ARROW_HAVE_RUNTIME_AVX2)
Implementation{DispatchLevel::AVX2, &ByteStreamSplitEncodeAvx2<kNumStreams>},
Implementation{DispatchLevel::AVX2, &ByteStreamSplitEncodeAvx2<kNumStreams>},
#endif
};
}
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/util/byte_stream_split_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ void ByteStreamSplitDecodeSimd(const uint8_t* data, int width, int64_t num_value

// Like xsimd::zip_lo, but zip groups of kNumBytes at once.
template <typename Arch, int kNumBytes>
auto zip_lo_n(const xsimd::batch<int8_t, Arch>& a, const xsimd::batch<int8_t, Arch>& b)
-> xsimd::batch<int8_t, Arch> {
auto zip_lo_n(const xsimd::batch<int8_t, Arch>& a,
const xsimd::batch<int8_t, Arch>& b) -> xsimd::batch<int8_t, Arch> {
using arrow::internal::SizedInt;
using simd_batch = xsimd::batch<int8_t, Arch>;
// For signed arithmetic
Expand All @@ -146,8 +146,8 @@ auto zip_lo_n(const xsimd::batch<int8_t, Arch>& a, const xsimd::batch<int8_t, Ar

// Like xsimd::zip_hi, but zip groups of kNumBytes at once.
template <typename Arch, int kNumBytes>
auto zip_hi_n(const xsimd::batch<int8_t, Arch>& a, const xsimd::batch<int8_t, Arch>& b)
-> xsimd::batch<int8_t, Arch> {
auto zip_hi_n(const xsimd::batch<int8_t, Arch>& a,
const xsimd::batch<int8_t, Arch>& b) -> xsimd::batch<int8_t, Arch> {
using simd_batch = xsimd::batch<int8_t, Arch>;
using arrow::internal::SizedInt;
// For signed arithmetic
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/util/compare.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class EqualityComparable {
}
};

friend bool operator==(T const& a, T const& b) { return a.Equals(b); }
friend bool operator!=(T const& a, T const& b) { return !(a == b); }
friend bool operator==(const T& a, const T& b) { return a.Equals(b); }
friend bool operator!=(const T& a, const T& b) { return !(a == b); }

private:
const T& cast() const { return static_cast<const T&>(*this); }
Expand Down
Loading
Loading