mapleFU commented on PR #38466:
URL: https://github.com/apache/arrow/pull/38466#issuecomment-1782212775

   Also cannot re-produce by:
   
   ```
   
   class DelayedBufferReader : public ::arrow::io::BufferReader {
    public:
     explicit DelayedBufferReader(const std::shared_ptr<::arrow::Buffer>& 
buffer)
         : ::arrow::io::BufferReader(buffer) {}
   
     ::arrow::Future<std::shared_ptr<Buffer>> ReadAsync(const 
::arrow::io::IOContext& io_context, int64_t position,
                                                        int64_t nbytes) 
override {
       read_async_count.fetch_add(1);
       std::this_thread::sleep_for(std::chrono::seconds(1));
       return ::arrow::io::BufferReader::ReadAsync(io_context, position, 
nbytes);
     }
   
     std::atomic<int> read_async_count{0};
   };
   
   TEST_F(TestParquetFileFormat, MultithreadedScanUnsafe) {
     auto reader = GetRecordBatchReader(schema({field("utf8", utf8())}));
   
     ASSERT_OK_AND_ASSIGN(auto buffer, 
ParquetFormatHelper::Write(reader.get()));
     auto buffer_reader = std::make_shared<DelayedBufferReader>(buffer);
     auto source = std::make_shared<FileSource>(std::move(buffer_reader), 
buffer->size());
   
     auto fragment = MakeFragment(*source);
   
     auto options = std::make_shared<ScanOptions>();
     auto fragment_scan_options = 
std::make_shared<ParquetFragmentScanOptions>();
     fragment_scan_options->arrow_reader_properties->set_pre_buffer(true);
     options->fragment_scan_options = fragment_scan_options;
     options->use_threads = true;
     ScannerBuilder builder(ArithmeticDatasetFixture::schema(), fragment, 
options);
   
     ASSERT_OK(builder.UseThreads(true));
     ASSERT_OK(builder.BatchSize(128));
     ASSERT_OK_AND_ASSIGN(auto scanner, builder.Finish());
   
     ASSERT_OK_AND_ASSIGN(auto batch, scanner->Head(8000));
     ASSERT_OK_AND_ASSIGN(batch, scanner->Head(8000 * 10));
     ASSERT_OK_AND_ASSIGN(batch, scanner->Head(8000 * 10));
   }
   ```


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

Reply via email to