Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions r/src/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ std::string fs___FileSystem__type_name(

// [[arrow::export]]
std::shared_ptr<fs::LocalFileSystem> fs___LocalFileSystem__create() {
return std::make_shared<fs::LocalFileSystem>();
// Affects OpenInputFile/OpenInputStream
auto io_context = arrow::io::IOContext(gc_memory_pool());
return std::make_shared<fs::LocalFileSystem>(io_context);
}

// [[arrow::export]]
Expand Down Expand Up @@ -315,7 +317,8 @@ std::shared_ptr<fs::S3FileSystem> fs___S3FileSystem__create(
s3_opts.background_writes = background_writes;

StopIfNotOk(fs::EnsureS3Initialized());
return ValueOrStop(fs::S3FileSystem::Make(s3_opts));
auto io_context = arrow::io::IOContext(gc_memory_pool());
return ValueOrStop(fs::S3FileSystem::Make(s3_opts, io_context));
}

// [[s3::export]]
Expand Down
8 changes: 6 additions & 2 deletions r/src/recordbatchreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ std::shared_ptr<arrow::RecordBatch> RecordBatchReader__ReadNext(
// [[arrow::export]]
std::shared_ptr<arrow::ipc::RecordBatchStreamReader> ipc___RecordBatchStreamReader__Open(
const std::shared_ptr<arrow::io::InputStream>& stream) {
return ValueOrStop(arrow::ipc::RecordBatchStreamReader::Open(stream));
auto options = arrow::ipc::IpcReadOptions::Defaults();
options.memory_pool = gc_memory_pool();
return ValueOrStop(arrow::ipc::RecordBatchStreamReader::Open(stream, options));
}

// [[arrow::export]]
Expand Down Expand Up @@ -85,7 +87,9 @@ std::shared_ptr<arrow::RecordBatch> ipc___RecordBatchFileReader__ReadRecordBatch
// [[arrow::export]]
std::shared_ptr<arrow::ipc::RecordBatchFileReader> ipc___RecordBatchFileReader__Open(
const std::shared_ptr<arrow::io::RandomAccessFile>& file) {
return ValueOrStop(arrow::ipc::RecordBatchFileReader::Open(file));
auto options = arrow::ipc::IpcReadOptions::Defaults();
options.memory_pool = gc_memory_pool();
return ValueOrStop(arrow::ipc::RecordBatchFileReader::Open(file, options));
}

// [[arrow::export]]
Expand Down
2 changes: 2 additions & 0 deletions r/src/recordbatchwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ std::shared_ptr<arrow::ipc::RecordBatchWriter> ipc___RecordBatchFileWriter__Open
auto options = arrow::ipc::IpcWriteOptions::Defaults();
options.write_legacy_ipc_format = use_legacy_format;
options.metadata_version = metadata_version;
options.memory_pool = gc_memory_pool();
return ValueOrStop(arrow::ipc::MakeFileWriter(stream, schema, options));
}

Expand All @@ -59,6 +60,7 @@ std::shared_ptr<arrow::ipc::RecordBatchWriter> ipc___RecordBatchStreamWriter__Op
auto options = arrow::ipc::IpcWriteOptions::Defaults();
options.write_legacy_ipc_format = use_legacy_format;
options.metadata_version = metadata_version;
options.memory_pool = gc_memory_pool();
return ValueOrStop(MakeStreamWriter(stream, schema, options));
}

Expand Down