mapleFU commented on code in PR #40876:
URL: https://github.com/apache/arrow/pull/40876#discussion_r1549806860
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -1373,4 +1408,123 @@ BENCHMARK_DEFINE_F(BM_ArrowBinaryDict,
DecodeArrowNonNull_Dict)
BENCHMARK_REGISTER_F(BM_ArrowBinaryDict, DecodeArrowNonNull_Dict)
->Range(MIN_RANGE, MAX_RANGE);
+class BenchmarkDecodeArrowBoolean : public
BenchmarkDecodeArrowBase<BooleanType> {
+ public:
+ void InitDataInputs() final {
+ // Generate a random string dictionary without any nulls so that this
dataset can
+ // be used for benchmarking the DecodeArrowNonNull API
+ constexpr int repeat_factor = 8;
+ ::arrow::random::RandomArrayGenerator rag(0);
+ input_array_ =
+ rag.Boolean(num_values_, num_values_ / repeat_factor,
null_probability_);
+ valid_bits_ = input_array_->null_bitmap_data();
+
+ // Arrow uses a bitmap representation for boolean arrays,
+ // so, we uses this as "total_size" for the benchmark.
+ total_size_ = ::arrow::bit_util::BytesForBits(num_values_);
+
+ values_.reserve(num_values_);
+ const auto& boolean_array = static_cast<const
::arrow::BooleanArray&>(*input_array_);
+ for (int64_t i = 0; i < boolean_array.length(); i++) {
+ values_.push_back(boolean_array.Value(i));
+ }
+ }
+
+ typename EncodingTraits<BooleanType>::Accumulator CreateAccumulator() final {
+ return typename EncodingTraits<BooleanType>::Accumulator();
+ }
+
+ void DoEncodeLowLevel() final { ParquetException::NYI(); }
+
+ void DecodeArrowWithNullDenseBenchmark(benchmark::State& state);
+
+ protected:
+ double null_probability_ = 0.0;
+};
+
+void BenchmarkDecodeArrowBoolean::DecodeArrowWithNullDenseBenchmark(
Review Comment:
"dense" is compared with "sparse read" ( firstly in ByteArray decoding),
which means not decode null or non-selected value?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]