icexelloss commented on code in PR #13426: URL: https://github.com/apache/arrow/pull/13426#discussion_r919412017
########## cpp/src/arrow/compute/exec/asof_join_benchmark.cc: ########## @@ -0,0 +1,1023 @@ +// 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 <stdio.h> +#include <stdlib.h> +#include <condition_variable> +#include <mutex> +#include <string> + +#include "benchmark/benchmark.h" + +#include "arrow/compute/cast.h" +#include "arrow/compute/exec.h" +#include "arrow/compute/exec/expression.h" +#include "arrow/compute/exec/options.h" +#include "arrow/compute/exec/task_util.h" +#include "arrow/compute/exec/test_util.h" +#include "arrow/dataset/partition.h" +#include "arrow/filesystem/api.h" +#include "arrow/ipc/api.h" +#include "arrow/testing/future_util.h" +#include "arrow/testing/generator.h" +#include "arrow/testing/gtest_util.h" +#include "arrow/type.h" + +namespace arrow { +namespace compute { + +static const char* time_col = "time"; +static const char* key_col = "id"; +static bool createdBenchmarkFiles = false; + +// requires export PYTHONPATH=/path/to/bamboo-streaming +// calls generate_benchmark_files to create tables (feather files) varying in frequency, +// width, key density for benchmarks. places generated files in benchmark/data. This +// operation runs once at the beginning of benchmarking. +static void DoSetup() { + if (!createdBenchmarkFiles) { + system( + "mkdir benchmark_data/ && python3 " + "~/summer/bamboo-streaming/bamboo/generate_benchmark_files.py"); + createdBenchmarkFiles = true; + } +} Review Comment: > Hmm, would it be possible to do the data generation in C++? It's possible but I feel things like data generation is much easier to write in python comparing to C++ (could be biased because I am more familiar with Python, Ivan is an intern working for me in the summer but I will be maintaining this code going forward). I agree that it's not ideal to have "random scripts scattered across the codebase" and my hope is what we can standardize these benchmark dataset generation in Python and use them for both microbenchmarks and end-to-end benchmarks. Since we plan to add more time series related functionalities, I would like to use this script as a starting point for all future time series benchmarks. Does that sounds acceptable? ########## cpp/src/arrow/compute/exec/asof_join_benchmark.cc: ########## @@ -0,0 +1,1023 @@ +// 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 <stdio.h> +#include <stdlib.h> +#include <condition_variable> +#include <mutex> +#include <string> + +#include "benchmark/benchmark.h" + +#include "arrow/compute/cast.h" +#include "arrow/compute/exec.h" +#include "arrow/compute/exec/expression.h" +#include "arrow/compute/exec/options.h" +#include "arrow/compute/exec/task_util.h" +#include "arrow/compute/exec/test_util.h" +#include "arrow/dataset/partition.h" +#include "arrow/filesystem/api.h" +#include "arrow/ipc/api.h" +#include "arrow/testing/future_util.h" +#include "arrow/testing/generator.h" +#include "arrow/testing/gtest_util.h" +#include "arrow/type.h" + +namespace arrow { +namespace compute { + +static const char* time_col = "time"; +static const char* key_col = "id"; +static bool createdBenchmarkFiles = false; + +// requires export PYTHONPATH=/path/to/bamboo-streaming +// calls generate_benchmark_files to create tables (feather files) varying in frequency, +// width, key density for benchmarks. places generated files in benchmark/data. This +// operation runs once at the beginning of benchmarking. +static void DoSetup() { + if (!createdBenchmarkFiles) { + system( + "mkdir benchmark_data/ && python3 " + "~/summer/bamboo-streaming/bamboo/generate_benchmark_files.py"); + createdBenchmarkFiles = true; + } +} Review Comment: > Hmm, would it be possible to do the data generation in C++? It's possible but I feel things like data generation is much easier to write in python comparing to C++ (could be biased because I am more familiar with Python, Ivan is an intern working for me in the summer and I will be maintaining this code going forward). I agree that it's not ideal to have "random scripts scattered across the codebase" and my hope is what we can standardize these benchmark dataset generation in Python and use them for both microbenchmarks and end-to-end benchmarks. Since we plan to add more time series related functionalities, I would like to use this script as a starting point for all future time series benchmarks. Does that sounds acceptable? -- 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]
