wesm commented on a change in pull request #7088:
URL: https://github.com/apache/arrow/pull/7088#discussion_r419799490



##########
File path: cpp/src/arrow/csv/converter_benchmark.cc
##########
@@ -20,15 +20,67 @@
 #include <sstream>
 #include <string>
 
+#include "arrow/buffer.h"
 #include "arrow/csv/converter.h"
 #include "arrow/csv/options.h"
 #include "arrow/csv/parser.h"
+#include "arrow/csv/reader.h"
 #include "arrow/csv/test_common.h"
+#include "arrow/io/memory.h"
 #include "arrow/testing/gtest_util.h"
+#include "arrow/util/value_parsing.h"
 
 namespace arrow {
 namespace csv {
 
+static std::shared_ptr<Buffer> GenerateTimestampsCSV(
+    const std::vector<std::string>& dates, int32_t cols, int32_t rows) {
+  std::stringstream ss;
+  for (int32_t row = 0; row < rows; ++row) {
+    for (int32_t col = 0; col < cols; ++col) {
+      ss << dates[rand() % dates.size()];
+    }
+    ss << "\n";
+  }
+  return Buffer::FromString(ss.str());
+}
+
+static Status ReadCSV(const Buffer& data, const csv::ConvertOptions& 
convert_opt) {
+  ARROW_ASSIGN_OR_RAISE(
+      auto table_reader,
+      csv::TableReader::Make(
+          default_memory_pool(), std::make_shared<io::BufferReader>(data),
+          csv::ReadOptions::Defaults(), csv::ParseOptions::Defaults(), 
convert_opt));
+  return table_reader->Read().status();
+}
+
+const std::vector<std::string> kExampleDates = {
+    "1917-10-17,", "2018-09-13 22,", "1941-06-22 04:00,", "1945-05-09 
09:45:38,"};
+constexpr int32_t kNumRows = 10000000;
+constexpr int32_t kNumCols = 10;
+
+static void ConvertTimestampVirtualISO8601(benchmark::State& state) {
+  auto data = GenerateTimestampsCSV(kExampleDates, kNumCols, kNumRows);
+  auto convert_options = csv::ConvertOptions::Defaults();
+  convert_options.timestamp_parsers.push_back(TimestampParser::MakeISO8601());
+  for (auto _ : state) {
+    ABORT_NOT_OK(ReadCSV(*data, convert_options));

Review comment:
       sorry I missed this, done




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to