save-buffer commented on a change in pull request #11876: URL: https://github.com/apache/arrow/pull/11876#discussion_r767348040
########## File path: cpp/src/arrow/compute/exec/hash_join_benchmark.cc ########## @@ -0,0 +1,425 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include "benchmark/benchmark.h" + +#include "arrow/api.h" +#include "arrow/compute/exec/hash_join.h" +#include "arrow/compute/exec/options.h" +#include "arrow/compute/exec/test_util.h" +#include "arrow/compute/exec/util.h" +#include "arrow/compute/kernels/row_encoder.h" +#include "arrow/compute/kernels/test_util.h" +#include "arrow/testing/gtest_util.h" +#include "arrow/testing/matchers.h" +#include "arrow/testing/random.h" +#include "arrow/util/checked_cast.h" +#include "arrow/util/make_unique.h" +#include "arrow/util/pcg_random.h" +#include "arrow/util/thread_pool.h" + +#include <cstdint> +#include <cstdio> +#include <memory> + +#include <omp.h> + +namespace arrow { +namespace compute { +struct BenchmarkSettings { + int num_threads = 1; + JoinType join_type = JoinType::INNER; + int batch_size = 1024; + int num_build_batches = 32; + int num_probe_batches = 32 * 16; + std::vector<std::shared_ptr<DataType>> key_types = {int32()}; + std::vector<std::shared_ptr<DataType>> build_payload_types = {}; + std::vector<std::shared_ptr<DataType>> probe_payload_types = {}; + + double null_percentage = 0.0; + double cardinality = 1.0; // Proportion of distinct keys in build side + double selectivity = 1.0; // Probability of a match for a given row Review comment: Cardinality is always the number of distinct values. Cardinality is actually a huge field in query optimization - clever streaming algorithms like HyperLogLog have been developed to approximate it. It's used in query optimization for determining the best join strategy. Selectivity is generally a filtering term, but a Join is a type of filter. If you think about it, join is a combination of group by, project, and filter, so selectivity is also used when talking about joins. The most common way selectivity is defined for a join is as the ratio between number of output rows and the size of the cross product of its input relations (i.e. |R⨝S|/|R⨯S|), but my definition is similar. -- 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]
