MCPcopy Create free account
hub / github.com/apache/arrow / BM_WriteInt64Column

Function BM_WriteInt64Column

cpp/src/parquet/column_io_benchmark.cc:70–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70static void BM_WriteInt64Column(::benchmark::State& state, Repetition::type repetition,
71 Compression::type codec, Encoding::type encoding) {
72 format::ColumnChunk thrift_metadata;
73
74 ::arrow::random::RandomArrayGenerator rgen(1337);
75 auto values = rgen.Int64(state.range(0), 0, 1000000, 0);
76 const auto& int64_values = static_cast<const ::arrow::Int64Array&>(*values);
77
78 std::vector<int16_t> definition_levels(state.range(0), 1);
79 std::vector<int16_t> repetition_levels(state.range(0), 0);
80 std::shared_ptr<ColumnDescriptor> schema = Int64Schema(repetition);
81 std::shared_ptr<WriterProperties> properties = WriterProperties::Builder()
82 .compression(codec)
83 ->encoding(encoding)
84 ->disable_dictionary()
85 ->build();
86 auto metadata = ColumnChunkMetaDataBuilder::Make(
87 properties, schema.get(), reinterpret_cast<uint8_t*>(&thrift_metadata));
88
89 int64_t data_size = values->length() * sizeof(int64_t);
90 int64_t stream_size = 0;
91 for (auto _ : state) {
92 auto stream = CreateOutputStream();
93 std::shared_ptr<Int64Writer> writer = BuildWriter(
94 state.range(0), stream, metadata.get(), schema.get(), properties.get(), codec);
95 writer->WriteBatch(int64_values.length(), definition_levels.data(),
96 repetition_levels.data(), int64_values.raw_values());
97 writer->Close();
98 stream_size = stream->Tell().ValueOrDie();
99 }
100 SetBytesProcessed(state, repetition);
101 state.counters["compression_ratio"] = static_cast<double>(data_size) / stream_size;
102}
103
104template <Repetition::type repetition,
105 Compression::type codec = Compression::UNCOMPRESSED,

Callers

nothing calls this directly

Calls 15

CreateOutputStreamFunction · 0.85
BuildWriterFunction · 0.85
ValueOrDieMethod · 0.80
Int64SchemaFunction · 0.70
BuilderFunction · 0.70
MakeFunction · 0.70
SetBytesProcessedFunction · 0.70
Int64Method · 0.45
buildMethod · 0.45
encodingMethod · 0.45
compressionMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected