Skip to content

Commit 702edcf

Browse files
author
Rafał Hibner
committed
Lint
1 parent 0624fbb commit 702edcf

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

cpp/src/arrow/dataset/dataset_writer.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <mutex>
2323
#include <unordered_map>
2424
#include <unordered_set>
25-
#include <iostream>
2625

2726
#include "arrow/filesystem/path_util.h"
2827
#include "arrow/record_batch.h"

cpp/src/arrow/dataset/dataset_writer_test.cc

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
#include <chrono>
2121
#include <mutex>
2222
#include <optional>
23-
#include <vector>
2423
#include <random>
2524
#include <thread>
25+
#include <vector>
2626

2727
#include "arrow/array/builder_primitive.h"
2828
#include "arrow/dataset/file_ipc.h"
@@ -278,29 +278,31 @@ TEST_F(DatasetWriterTestFixture, BatchGreaterThanMaxRowsQueued) {
278278
}
279279

280280
#pragma GCC push_options
281-
#pragma GCC optimize ("O0")
281+
#pragma GCC optimize("O0")
282282
TEST_F(DatasetWriterTestFixture, BatchWriteConcurrent) {
283283
auto dataset_writer = MakeDatasetWriter(/*max_rows=*/5);
284284

285-
286-
for(int threads=1;threads<5;threads++){
287-
for(int iter=2;iter<=256;iter*=2){
288-
for(int batch=2;batch<=64;batch*=2){
285+
for (int threads = 1; threads < 5; threads++) {
286+
for (int iter = 2; iter <= 256; iter *= 2) {
287+
for (int batch = 2; batch <= 64; batch *= 2) {
289288
std::vector<std::thread> workers;
290-
for(int i=0;i<threads;++i){
291-
workers.push_back(std::thread(
292-
[&,i=i](){
293-
for(int j=0;j<iter;++j){
294-
while(paused_){SleepABit();};
295-
dataset_writer->WriteRecordBatch(MakeBatch(batch+i+10*j), "");
289+
for (int i = 0; i < threads; ++i) {
290+
workers.push_back(std::thread([&, i = i]() {
291+
for (int j = 0; j < iter; ++j) {
292+
while (paused_) {
293+
SleepABit();
294+
}
295+
dataset_writer->WriteRecordBatch(MakeBatch(batch + i + 10 * j), "");
296296
}
297297
}));
298298
}
299-
for (std::thread &t: workers) {
299+
for (std::thread& t : workers) {
300300
if (t.joinable()) {
301301
t.join();
302302
}
303-
while(paused_){SleepABit();};
303+
while (paused_) {
304+
SleepABit();
305+
}
304306
}
305307
}
306308
}

0 commit comments

Comments
 (0)