Skip to content

Commit d7367ff

Browse files
committed
ARROW-14922: [C++][Parquet] Fix column-io-benchmark throws
Fix benchmark throws if compression modules are disabled. Closes apache#11801 from cyb70289/14922-parquet-bench Authored-by: Yibo Cai <yibo.cai@arm.com> Signed-off-by: Yibo Cai <yibo.cai@arm.com>
1 parent 113e6a6 commit d7367ff

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

cpp/src/arrow/ipc/read_write_benchmark.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ static void DecodeStream(benchmark::State& state) { // NOLINT non-const referen
159159
state.SetBytesProcessed(int64_t(state.iterations()) * kTotalSize);
160160
}
161161

162+
#ifdef ARROW_WITH_ZSTD
162163
#define GENERATE_COMPRESSED_DATA_IN_MEMORY() \
163164
constexpr int64_t kBatchSize = 1 << 20; /* 1 MB */ \
164165
constexpr int64_t kBatches = 16; \
@@ -176,6 +177,7 @@ static void DecodeStream(benchmark::State& state) { // NOLINT non-const referen
176177
ABORT_NOT_OK(writer->Close()); \
177178
ABORT_NOT_OK(stream.Close()); \
178179
}
180+
#endif
179181

180182
#define GENERATE_DATA_IN_MEMORY() \
181183
constexpr int64_t kBatchSize = 1 << 20; /* 1 MB */ \
@@ -251,8 +253,10 @@ static void DecodeStream(benchmark::State& state) { // NOLINT non-const referen
251253
READ_BENCHMARK(ReadFile, GENERATE_DATA_IN_MEMORY, READ_DATA_IN_MEMORY);
252254
READ_BENCHMARK(ReadTempFile, GENERATE_DATA_TEMP_FILE, READ_DATA_TEMP_FILE);
253255
READ_BENCHMARK(ReadMmapFile, GENERATE_DATA_TEMP_FILE, READ_DATA_MMAP_FILE);
256+
#ifdef ARROW_WITH_ZSTD
254257
READ_BENCHMARK(ReadCompressedFile, GENERATE_COMPRESSED_DATA_IN_MEMORY,
255258
READ_DATA_IN_MEMORY);
259+
#endif
256260

257261
BENCHMARK(WriteRecordBatch)->RangeMultiplier(4)->Range(1, 1 << 13)->UseRealTime();
258262
BENCHMARK(ReadRecordBatch)->RangeMultiplier(4)->Range(1, 1 << 13)->UseRealTime();

cpp/src/parquet/column_io_benchmark.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,26 +98,33 @@ static void BM_WriteInt64Column(::benchmark::State& state) {
9898
BENCHMARK_TEMPLATE(BM_WriteInt64Column, Repetition::REQUIRED)->Arg(1 << 20);
9999
BENCHMARK_TEMPLATE(BM_WriteInt64Column, Repetition::OPTIONAL)->Arg(1 << 20);
100100
BENCHMARK_TEMPLATE(BM_WriteInt64Column, Repetition::REPEATED)->Arg(1 << 20);
101+
102+
#ifdef ARROW_WITH_SNAPPY
101103
BENCHMARK_TEMPLATE(BM_WriteInt64Column, Repetition::REQUIRED, Compression::SNAPPY)
102104
->Arg(1 << 20);
103105
BENCHMARK_TEMPLATE(BM_WriteInt64Column, Repetition::OPTIONAL, Compression::SNAPPY)
104106
->Arg(1 << 20);
105107
BENCHMARK_TEMPLATE(BM_WriteInt64Column, Repetition::REPEATED, Compression::SNAPPY)
106108
->Arg(1 << 20);
109+
#endif
107110

111+
#ifdef ARROW_WITH_LZ4
108112
BENCHMARK_TEMPLATE(BM_WriteInt64Column, Repetition::REQUIRED, Compression::LZ4)
109113
->Arg(1 << 20);
110114
BENCHMARK_TEMPLATE(BM_WriteInt64Column, Repetition::OPTIONAL, Compression::LZ4)
111115
->Arg(1 << 20);
112116
BENCHMARK_TEMPLATE(BM_WriteInt64Column, Repetition::REPEATED, Compression::LZ4)
113117
->Arg(1 << 20);
118+
#endif
114119

120+
#ifdef ARROW_WITH_ZSTD
115121
BENCHMARK_TEMPLATE(BM_WriteInt64Column, Repetition::REQUIRED, Compression::ZSTD)
116122
->Arg(1 << 20);
117123
BENCHMARK_TEMPLATE(BM_WriteInt64Column, Repetition::OPTIONAL, Compression::ZSTD)
118124
->Arg(1 << 20);
119125
BENCHMARK_TEMPLATE(BM_WriteInt64Column, Repetition::REPEATED, Compression::ZSTD)
120126
->Arg(1 << 20);
127+
#endif
121128

122129
std::shared_ptr<Int64Reader> BuildReader(std::shared_ptr<Buffer>& buffer,
123130
int64_t num_values, Compression::type codec,
@@ -183,26 +190,32 @@ BENCHMARK_TEMPLATE(BM_ReadInt64Column, Repetition::OPTIONAL)->Apply(ReadColumnSe
183190

184191
BENCHMARK_TEMPLATE(BM_ReadInt64Column, Repetition::REPEATED)->Apply(ReadColumnSetArgs);
185192

193+
#ifdef ARROW_WITH_SNAPPY
186194
BENCHMARK_TEMPLATE(BM_ReadInt64Column, Repetition::REQUIRED, Compression::SNAPPY)
187195
->Apply(ReadColumnSetArgs);
188196
BENCHMARK_TEMPLATE(BM_ReadInt64Column, Repetition::OPTIONAL, Compression::SNAPPY)
189197
->Apply(ReadColumnSetArgs);
190198
BENCHMARK_TEMPLATE(BM_ReadInt64Column, Repetition::REPEATED, Compression::SNAPPY)
191199
->Apply(ReadColumnSetArgs);
200+
#endif
192201

202+
#ifdef ARROW_WITH_LZ4
193203
BENCHMARK_TEMPLATE(BM_ReadInt64Column, Repetition::REQUIRED, Compression::LZ4)
194204
->Apply(ReadColumnSetArgs);
195205
BENCHMARK_TEMPLATE(BM_ReadInt64Column, Repetition::OPTIONAL, Compression::LZ4)
196206
->Apply(ReadColumnSetArgs);
197207
BENCHMARK_TEMPLATE(BM_ReadInt64Column, Repetition::REPEATED, Compression::LZ4)
198208
->Apply(ReadColumnSetArgs);
209+
#endif
199210

211+
#ifdef ARROW_WITH_ZSTD
200212
BENCHMARK_TEMPLATE(BM_ReadInt64Column, Repetition::REQUIRED, Compression::ZSTD)
201213
->Apply(ReadColumnSetArgs);
202214
BENCHMARK_TEMPLATE(BM_ReadInt64Column, Repetition::OPTIONAL, Compression::ZSTD)
203215
->Apply(ReadColumnSetArgs);
204216
BENCHMARK_TEMPLATE(BM_ReadInt64Column, Repetition::REPEATED, Compression::ZSTD)
205217
->Apply(ReadColumnSetArgs);
218+
#endif
206219

207220
static void BM_RleEncoding(::benchmark::State& state) {
208221
std::vector<int16_t> levels(state.range(0), 0);

0 commit comments

Comments
 (0)