Skip to content

Commit 7c8d526

Browse files
committed
Nits
1 parent 8fa07b0 commit 7c8d526

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

cpp/src/arrow/compute/kernels/aggregate.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ Status AggregateUnaryKernel::Call(FunctionContext* ctx, const Datum& input, Datu
5454
return Status::Invalid("AggregateKernel expects Array or ChunkedArray datum");
5555
}
5656
auto state = ManagedAggregateState::Make(aggregate_function_, ctx->memory_pool());
57-
if (!state) return Status::OutOfMemory("AggregateState allocation failed");
57+
if (!state) {
58+
return Status::OutOfMemory("AggregateState allocation failed");
59+
}
5860

5961
if (input.is_array()) {
6062
auto array = input.make_array();
@@ -64,7 +66,9 @@ Status AggregateUnaryKernel::Call(FunctionContext* ctx, const Datum& input, Datu
6466
for (int i = 0; i < chunked_array->num_chunks(); i++) {
6567
auto tmp_state =
6668
ManagedAggregateState::Make(aggregate_function_, ctx->memory_pool());
67-
if (!tmp_state) return Status::OutOfMemory("AggregateState allocation failed");
69+
if (!tmp_state) {
70+
return Status::OutOfMemory("AggregateState allocation failed");
71+
}
6872
RETURN_NOT_OK(aggregate_function_->Consume(*chunked_array->chunk(i),
6973
tmp_state->mutable_data()));
7074
RETURN_NOT_OK(

cpp/src/arrow/compute/kernels/aggregate_test.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,16 @@ TYPED_TEST(TestNumericSumKernel, SimpleSum) {
140140
ValidateSum<TypeParam>(&this->ctx_, "[0, 1, 2, 3, 4, 5]",
141141
Datum(std::make_shared<ScalarType>(static_cast<T>(5 * 6 / 2))));
142142

143-
std::vector<std::string> json{"[0, 1, 2, 3, 4, 5]"};
144-
ValidateSum<TypeParam>(&this->ctx_, json,
143+
std::vector<std::string> chunks = {"[0, 1, 2, 3, 4, 5]"};
144+
ValidateSum<TypeParam>(&this->ctx_, chunks,
145145
Datum(std::make_shared<ScalarType>(static_cast<T>(5 * 6 / 2))));
146146

147-
json = {"[0, 1, 2]", "[3, 4, 5]"};
148-
ValidateSum<TypeParam>(&this->ctx_, json,
147+
chunks = {"[0, 1, 2]", "[3, 4, 5]"};
148+
ValidateSum<TypeParam>(&this->ctx_, chunks,
149149
Datum(std::make_shared<ScalarType>(static_cast<T>(5 * 6 / 2))));
150150

151-
json = {"[0, 1, 2]", "[]", "[3, 4, 5]"};
152-
ValidateSum<TypeParam>(&this->ctx_, json,
151+
chunks = {"[0, 1, 2]", "[]", "[3, 4, 5]"};
152+
ValidateSum<TypeParam>(&this->ctx_, chunks,
153153
Datum(std::make_shared<ScalarType>(static_cast<T>(5 * 6 / 2))));
154154

155155
const T expected_result = static_cast<T>(14);

0 commit comments

Comments
 (0)