n3world commented on a change in pull request #10509:
URL: https://github.com/apache/arrow/pull/10509#discussion_r652157067



##########
File path: cpp/src/arrow/csv/reader_test.cc
##########
@@ -216,6 +216,27 @@ TEST(StreamingReaderTests, NestedParallelism) {
   TestNestedParallelism(thread_pool, table_factory);
 }
 
+TEST(StreamingReaderTest, BytesRead) {
+  ASSERT_OK_AND_ASSIGN(auto thread_pool, internal::ThreadPool::Make(1));
+  auto table_buffer =
+      
std::make_shared<Buffer>("a,b,c\n123,456,789\n101,112,131\n415,161,718\n");
+  auto input = std::make_shared<io::BufferReader>(table_buffer);
+  auto read_options = ReadOptions::Defaults();
+  read_options.block_size = 20;
+  ASSERT_OK_AND_ASSIGN(
+      auto streaming_reader,
+      StreamingReader::Make(io::default_io_context(), input, read_options,
+                            ParseOptions::Defaults(), 
ConvertOptions::Defaults()));
+  std::shared_ptr<RecordBatch> batch;
+  int64_t bytes = 6;  // Size of header
+  do {
+    ASSERT_EQ(bytes, streaming_reader->bytes_read());
+    ASSERT_OK(streaming_reader->ReadNext(&batch));
+    bytes += 12;  // Add size of each row
+  } while (batch);
+  ASSERT_EQ(42, streaming_reader->bytes_read());
+}

Review comment:
       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