You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/09/21 15:44:19 UTC
[GitHub] [arrow] pitrou commented on a change in pull request #11198: ARROW-14053: [C++][CSV] Use atomic counter for async tests
pitrou commented on a change in pull request #11198:
URL: https://github.com/apache/arrow/pull/11198#discussion_r713172904
##########
File path: cpp/src/arrow/csv/reader_test.cc
##########
@@ -176,20 +177,21 @@ void TestNestedParallelism(std::shared_ptr<internal::ThreadPool> thread_pool,
ASSERT_EQ(table->num_rows(), NROWS);
}
-void TestInvalidRowsSkipped(TableReaderFactory reader_factory, bool rows_counted) {
+void TestInvalidRowsSkipped(TableReaderFactory reader_factory, bool async) {
const int NROWS = 1000;
const int INVALID_EVERY = 20;
const int NINVALID = 50;
auto opts = ParseOptions::Defaults();
- int num_invalid_rows = 0;
+ std::atomic<int> num_invalid_rows(0);
opts.invalid_row_handler = [&](const InvalidRow& row) {
++num_invalid_rows;
- if (rows_counted) {
+ if (async) {
+ // Row numbers are not counted in batches during async processing
+ EXPECT_EQ(-1, row.number);
+ } else {
// actual data starts at row #2 in the CSV "file"
EXPECT_EQ(num_invalid_rows * INVALID_EVERY + 1, row.number);
Review comment:
Is `num_invalid_rows` still unchanged from above?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org