| 142 | using SeparatorFactory = std::function<Datum(int64_t n, double null_probability)>; |
| 143 | |
| 144 | static void BinaryJoin(benchmark::State& state, SeparatorFactory make_separator) { |
| 145 | const int64_t n_strings = 10000; |
| 146 | const int64_t n_lists = 1000; |
| 147 | const double null_probability = 0.02; |
| 148 | |
| 149 | random::RandomArrayGenerator rng(kSeed); |
| 150 | |
| 151 | auto strings = |
| 152 | rng.String(n_strings, /*min_length=*/5, /*max_length=*/20, null_probability); |
| 153 | auto lists = rng.List(*strings, n_lists, null_probability, /*force_empty_nulls=*/true); |
| 154 | auto separator = make_separator(n_lists, null_probability); |
| 155 | |
| 156 | for (auto _ : state) { |
| 157 | ABORT_NOT_OK(CallFunction("binary_join", {lists, separator})); |
| 158 | } |
| 159 | state.SetBytesProcessed( |
| 160 | state.iterations() * |
| 161 | checked_cast<const StringArray&>(*strings).total_values_length()); |
| 162 | } |
| 163 | |
| 164 | static void BinaryJoinArrayScalar(benchmark::State& state) { |
| 165 | BinaryJoin(state, [](int64_t n, double null_probability) -> Datum { |
no test coverage detected