Skip to content

Commit

Permalink
R compat
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed May 14, 2024
1 parent 27a162b commit cc3c73d
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 25 deletions.
3 changes: 2 additions & 1 deletion cpp/src/arrow/array/concatenate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,8 @@ class ConcatenateImpl {
}
out_data += data->length * index_width;
}
return out;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(out));
}

Status Visit(const DictionaryType& d) {
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/arrow/array/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ class ArrayDataEndianSwapper {
for (int64_t i = 0; i < length; i++) {
out_data[i] = bit_util::ByteSwap(in_data[i]);
}
return out_buffer;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(out_buffer));
}

template <typename VALUE_TYPE>
Expand Down
12 changes: 8 additions & 4 deletions cpp/src/arrow/buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Result<std::shared_ptr<Buffer>> Buffer::CopySlice(const int64_t start,

ARROW_ASSIGN_OR_RAISE(auto new_buffer, AllocateResizableBuffer(nbytes, pool));
std::memcpy(new_buffer->mutable_data(), data() + start, static_cast<size_t>(nbytes));
return new_buffer;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(new_buffer));
}

Buffer::Buffer() : Buffer(memory_pool::internal::kZeroSizeArea, 0) {}
Expand Down Expand Up @@ -185,7 +186,8 @@ Result<std::shared_ptr<Buffer>> AllocateBitmap(int64_t length, MemoryPool* pool)
if (buf->size() > 0) {
buf->mutable_data()[buf->size() - 1] = 0;
}
return buf;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(buf));
}

Result<std::shared_ptr<Buffer>> AllocateEmptyBitmap(int64_t length, MemoryPool* pool) {
Expand All @@ -197,7 +199,8 @@ Result<std::shared_ptr<Buffer>> AllocateEmptyBitmap(int64_t length, int64_t alig
ARROW_ASSIGN_OR_RAISE(auto buf,
AllocateBuffer(bit_util::BytesForBits(length), alignment, pool));
memset(buf->mutable_data(), 0, static_cast<size_t>(buf->size()));
return buf;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(buf));
}

Status AllocateEmptyBitmap(int64_t length, std::shared_ptr<Buffer>* out) {
Expand All @@ -219,7 +222,8 @@ Result<std::shared_ptr<Buffer>> ConcatenateBuffers(
out_data += buffer->size();
}
}
return out;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(out));
}

} // namespace arrow
3 changes: 2 additions & 1 deletion cpp/src/arrow/compute/function_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,8 @@ const FunctionOptionsType* GetFunctionOptionsType(const Properties&... propertie
auto options = std::make_unique<Options>();
RETURN_NOT_OK(
FromStructScalarImpl<Options>(options.get(), scalar, properties_).status_);
return options;
// R build with openSUSE155 requires an explicit unique_ptr construction
return std::unique_ptr<FunctionOptions>(std::move(options));
}
std::unique_ptr<FunctionOptions> Copy(const FunctionOptions& options) const override {
auto out = std::make_unique<Options>();
Expand Down
6 changes: 4 additions & 2 deletions cpp/src/arrow/compute/kernels/hash_aggregate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ Result<std::unique_ptr<KernelState>> HashAggregateInit(KernelContext* ctx,
const KernelInitArgs& args) {
auto impl = std::make_unique<Impl>();
RETURN_NOT_OK(impl->Init(ctx->exec_context(), args));
return impl;
// R build with openSUSE155 requires an explicit unique_ptr construction
return std::unique_ptr<KernelState>(std::move(impl));
}

Status HashAggregateResize(KernelContext* ctx, int64_t num_groups) {
Expand Down Expand Up @@ -1114,7 +1115,8 @@ Result<std::unique_ptr<KernelState>> VarStdInit(KernelContext* ctx,
auto impl = std::make_unique<GroupedVarStdImpl<T>>();
impl->result_type_ = result_type;
RETURN_NOT_OK(impl->Init(ctx->exec_context(), args));
return impl;
// R build with openSUSE155 requires an explicit unique_ptr construction
return std::unique_ptr<KernelState>(std::move(impl));
}

template <VarOrStd result_type>
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/arrow/compute/kernels/vector_hash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,8 @@ Result<std::unique_ptr<KernelState>> HashInit(KernelContext* ctx,
auto result = std::make_unique<HashKernel>(args.inputs[0].GetSharedPtr(), args.options,
ctx->memory_pool());
RETURN_NOT_OK(result->Reset());
return result;
// R build with openSUSE155 requires an explicit unique_ptr construction
return std::unique_ptr<KernelState>(std::move(result));
}

template <typename Action>
Expand Down
7 changes: 5 additions & 2 deletions cpp/src/arrow/dataset/file_parquet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,8 @@ Result<std::shared_ptr<parquet::arrow::FileReader>> ParquetFileFormat::GetReader
std::unique_ptr<parquet::arrow::FileReader> arrow_reader;
RETURN_NOT_OK(parquet::arrow::FileReader::Make(
options->pool, std::move(reader), std::move(arrow_properties), &arrow_reader));
return arrow_reader;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<parquet::arrow::FileReader>(std::move(arrow_reader));
}

Future<std::shared_ptr<parquet::arrow::FileReader>> ParquetFileFormat::GetReaderAsync(
Expand Down Expand Up @@ -543,7 +544,9 @@ Future<std::shared_ptr<parquet::arrow::FileReader>> ParquetFileFormat::GetReader
reader)),
std::move(arrow_properties), &arrow_reader));

return arrow_reader;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<parquet::arrow::FileReader>(
std::move(arrow_reader));
},
[path = source.path()](const Status& status)
-> Result<std::shared_ptr<parquet::arrow::FileReader>> {
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/arrow/filesystem/s3fs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,8 @@ class ObjectInputFile final : public io::RandomAccessFile {
DCHECK_LE(bytes_read, nbytes);
RETURN_NOT_OK(buf->Resize(bytes_read));
}
return buf;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(buf));
}

Result<int64_t> Read(int64_t nbytes, void* out) override {
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/arrow/io/buffered.cc
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ class BufferedInputStream::Impl : public BufferedBase {
RETURN_NOT_OK(buffer->Resize(bytes_read, false /* shrink_to_fit */));
buffer->ZeroPadding();
}
return buffer;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(buffer));
}

// For providing access to the raw file handles
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/arrow/io/compressed.cc
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ class CompressedInputStream::Impl {
ARROW_ASSIGN_OR_RAISE(auto buf, AllocateResizableBuffer(nbytes, pool_));
ARROW_ASSIGN_OR_RAISE(int64_t bytes_read, Read(nbytes, buf->mutable_data()));
RETURN_NOT_OK(buf->Resize(bytes_read));
return buf;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(buf));
}

const std::shared_ptr<InputStream>& raw() const { return raw_; }
Expand Down
6 changes: 4 additions & 2 deletions cpp/src/arrow/io/file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ class ReadableFile::ReadableFileImpl : public OSFile {
RETURN_NOT_OK(buffer->Resize(bytes_read));
buffer->ZeroPadding();
}
return buffer;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(buffer));
}

Result<std::shared_ptr<Buffer>> ReadBufferAt(int64_t position, int64_t nbytes) {
Expand All @@ -242,7 +243,8 @@ class ReadableFile::ReadableFileImpl : public OSFile {
RETURN_NOT_OK(buffer->Resize(bytes_read));
buffer->ZeroPadding();
}
return buffer;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(buffer));
}

Status WillNeed(const std::vector<ReadRange>& ranges) {
Expand Down
6 changes: 4 additions & 2 deletions cpp/src/arrow/io/hdfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ class HdfsReadableFile::HdfsReadableFileImpl : public HdfsAnyFileImpl {
RETURN_NOT_OK(buffer->Resize(bytes_read));
buffer->ZeroPadding();
}
return buffer;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(buffer));
}

Result<int64_t> Read(int64_t nbytes, void* buffer) {
Expand Down Expand Up @@ -200,7 +201,8 @@ class HdfsReadableFile::HdfsReadableFileImpl : public HdfsAnyFileImpl {
if (bytes_read < nbytes) {
RETURN_NOT_OK(buffer->Resize(bytes_read));
}
return buffer;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(buffer));
}

Result<int64_t> GetSize() {
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/arrow/io/stdio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ Result<std::shared_ptr<Buffer>> StdinStream::Read(int64_t nbytes) {
ARROW_ASSIGN_OR_RAISE(int64_t bytes_read, Read(nbytes, buffer->mutable_data()));
ARROW_RETURN_NOT_OK(buffer->Resize(bytes_read, false));
buffer->ZeroPadding();
return buffer;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(buffer));
}

} // namespace io
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/arrow/ipc/metadata_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ static inline Result<std::shared_ptr<Buffer>> WriteFlatbufferBuilder(

uint8_t* dst = result->mutable_data();
memcpy(dst, fbb.GetBufferPointer(), size);
return result;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(result));
}

ARROW_EXPORT
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/arrow/ipc/reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,8 @@ Result<std::shared_ptr<Buffer>> DecompressBuffer(const std::shared_ptr<Buffer>&
actual_decompressed);
}

return uncompressed;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(uncompressed));
}

Status DecompressBuffers(Compression::type compression, const IpcReadOptions& options,
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/arrow/ipc/writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,8 @@ Result<std::unique_ptr<RecordBatchWriter>> OpenRecordBatchWriter(
auto writer = std::make_unique<internal::IpcFormatWriter>(
std::move(sink), schema, options, /*is_file_format=*/false);
RETURN_NOT_OK(writer->Start());
return writer;
// R build with openSUSE155 requires an explicit unique_ptr construction
return std::unique_ptr<RecordBatchWriter>(std::move(writer));
}

Result<std::unique_ptr<IpcPayloadWriter>> MakePayloadStreamWriter(
Expand Down
6 changes: 4 additions & 2 deletions cpp/src/arrow/util/bitmap_builders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ Result<std::shared_ptr<Buffer>> BytesToBits(const std::vector<uint8_t>& bytes,
uint8_t* out_buf = buffer->mutable_data();
memset(out_buf, 0, static_cast<size_t>(buffer->capacity()));
FillBitsFromBytes(bytes, out_buf);
return buffer;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(buffer));
}

Result<std::shared_ptr<Buffer>> BitmapAllButOne(MemoryPool* pool, int64_t length,
Expand All @@ -66,7 +67,8 @@ Result<std::shared_ptr<Buffer>> BitmapAllButOne(MemoryPool* pool, int64_t length
auto bitmap_data = buffer->mutable_data();
bit_util::SetBitsTo(bitmap_data, 0, length, value);
bit_util::SetBitTo(bitmap_data, straggler_pos, !value);
return buffer;
// R build with openSUSE155 requires an explicit shared_ptr construction
return std::shared_ptr<Buffer>(std::move(buffer));
}

} // namespace internal
Expand Down

0 comments on commit cc3c73d

Please sign in to comment.