Skip to content

Commit

Permalink
MINOR: [C++] Fix StringFormatter type error in localfs_benchmark (apa…
Browse files Browse the repository at this point in the history
…che#13932)

since size_t is passed as the first argument to the StringFormatter, it
needs to be templated with Int64Type instead of Int32Type

Lead-authored-by: Aldrin M <[email protected]>
Co-authored-by: Aldrin Montana <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
  • Loading branch information
drin authored and anjakefala committed Aug 31, 2022
1 parent 5130e68 commit bc85ae4
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions cpp/src/arrow/filesystem/localfs_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "arrow/testing/gtest_util.h"
#include "arrow/testing/random.h"
#include "arrow/util/async_generator.h"
#include "arrow/util/formatting.h"
#include "arrow/util/io_util.h"
#include "arrow/util/make_unique.h"
#include "arrow/util/string_view.h"
Expand Down Expand Up @@ -66,13 +65,9 @@ class LocalFSFixture : public benchmark::Fixture {
arrow::internal::PlatformFilename cur_root_dir) {
ASSERT_OK(arrow::internal::CreateDir(cur_root_dir));

arrow::internal::StringFormatter<Int32Type> format;
for (size_t i = 0; i < num_files_; ++i) {
std::string fname = "file_";
format(i, [&fname](util::string_view formatted) {
fname.append(formatted.data(), formatted.size());
});
ASSERT_OK_AND_ASSIGN(auto path, cur_root_dir.Join(std::move(fname)));
ASSERT_OK_AND_ASSIGN(auto path,
cur_root_dir.Join(std::string{"file_" + std::to_string(i)}));
ASSERT_OK(MakeEmptyFile(path.ToString()));
}

Expand All @@ -81,11 +76,8 @@ class LocalFSFixture : public benchmark::Fixture {
}

for (size_t i = 0; i < num_dirs_; ++i) {
std::string dirname = "dir_";
format(i, [&dirname](util::string_view formatted) {
dirname.append(formatted.data(), formatted.size());
});
ASSERT_OK_AND_ASSIGN(auto path, cur_root_dir.Join(std::move(dirname)));
ASSERT_OK_AND_ASSIGN(auto path,
cur_root_dir.Join(std::string{"dir_" + std::to_string(i)}));
InitializeDatasetStructure(cur_nesting_level + 1, std::move(path));
}
}
Expand Down

0 comments on commit bc85ae4

Please sign in to comment.