Merge pull request #45478 from Avogar/fix-arrow-abort

Fix possible aborts in arrow lib
This commit is contained in:
Kruglov Pavel 2023-01-24 16:37:44 +01:00 committed by GitHub
commit 689fbea759
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

2
contrib/arrow vendored

@ -1 +1 @@
Subproject commit 450a5638704386356f8e520080468fc9bc8bcaf8
Subproject commit d03245f801f798c63ee9a7d2b8914a9e5c5cd666

View File

@ -11,6 +11,7 @@
#include <IO/copyData.h>
#include <IO/PeekableReadBuffer.h>
#include <arrow/buffer.h>
#include <arrow/util/future.h>
#include <arrow/io/memory.h>
#include <arrow/result.h>
#include <Core/Settings.h>
@ -95,6 +96,12 @@ arrow::Result<std::shared_ptr<arrow::Buffer>> RandomAccessFileFromSeekableReadBu
return buffer;
}
arrow::Future<std::shared_ptr<arrow::Buffer>> RandomAccessFileFromSeekableReadBuffer::ReadAsync(const arrow::io::IOContext &, int64_t position, int64_t nbytes)
{
/// Just a stub to to avoid using internal arrow thread pool
return arrow::Future<std::shared_ptr<arrow::Buffer>>::MakeFinished(ReadAt(position, nbytes));
}
arrow::Status RandomAccessFileFromSeekableReadBuffer::Seek(int64_t position)
{
seekable_in.seek(position, SEEK_SET);

View File

@ -62,6 +62,11 @@ public:
arrow::Result<std::shared_ptr<arrow::Buffer>> Read(int64_t nbytes) override;
/// Override async reading to avoid using internal arrow thread pool.
/// In our code we don't use async reading, so implementation is sync,
/// we just call ReadAt and return future with ready value.
arrow::Future<std::shared_ptr<arrow::Buffer>> ReadAsync(const arrow::io::IOContext&, int64_t position, int64_t nbytes) override;
arrow::Status Seek(int64_t position) override;
private: