From 571fe821c3a3413a51a5e9d363896e914a143ad2 Mon Sep 17 00:00:00 2001 From: Shally Katariya <156352038+Shally-Katariya@users.noreply.github.com> Date: Thu, 25 Jun 2026 12:34:28 +0000 Subject: [PATCH] GH-50236: Remove obsolete OpenSUSE 15.5 workarounds --- cpp/src/arrow/array/concatenate.cc | 3 +- cpp/src/arrow/array/util.cc | 3 +- cpp/src/arrow/buffer.cc | 12 ++-- cpp/src/arrow/compute/function_internal.h | 3 +- .../arrow/compute/kernels/aggregate_pivot.cc | 5 +- .../compute/kernels/hash_aggregate_internal.h | 3 +- cpp/src/arrow/compute/kernels/vector_hash.cc | 3 +- cpp/src/arrow/dataset/file_parquet.cc | 63 +++++++++---------- cpp/src/arrow/filesystem/s3fs.cc | 3 +- cpp/src/arrow/io/buffered.cc | 3 +- cpp/src/arrow/io/compressed.cc | 3 +- cpp/src/arrow/io/hdfs.cc | 6 +- cpp/src/arrow/io/stdio.cc | 3 +- cpp/src/arrow/ipc/metadata_internal.h | 3 +- cpp/src/arrow/ipc/reader.cc | 3 +- cpp/src/arrow/ipc/writer.cc | 3 +- cpp/src/arrow/util/align_util.cc | 3 +- cpp/src/arrow/util/bitmap_builders.cc | 6 +- 18 files changed, 53 insertions(+), 78 deletions(-) diff --git a/cpp/src/arrow/array/concatenate.cc b/cpp/src/arrow/array/concatenate.cc index 999cbd1c87bf..34dd44d92d3f 100644 --- a/cpp/src/arrow/array/concatenate.cc +++ b/cpp/src/arrow/array/concatenate.cc @@ -636,8 +636,7 @@ class ConcatenateImpl { } out_data += data->length * index_width; } - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(out)); + return out; } Status Visit(const DictionaryType& d) { diff --git a/cpp/src/arrow/array/util.cc b/cpp/src/arrow/array/util.cc index 1c19bd5a5468..d97e2f7f85d9 100644 --- a/cpp/src/arrow/array/util.cc +++ b/cpp/src/arrow/array/util.cc @@ -125,8 +125,7 @@ class ArrayDataEndianSwapper { for (int64_t i = 0; i < length; i++) { out_data[i] = bit_util::ByteSwap(in_data[i]); } - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(out_buffer)); + return out_buffer; } template diff --git a/cpp/src/arrow/buffer.cc b/cpp/src/arrow/buffer.cc index f069277e7c37..17e745204640 100644 --- a/cpp/src/arrow/buffer.cc +++ b/cpp/src/arrow/buffer.cc @@ -41,8 +41,7 @@ Result> 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(nbytes)); - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(new_buffer)); + return new_buffer; } Buffer::Buffer() : Buffer(memory_pool::internal::kZeroSizeArea, 0) {} @@ -186,8 +185,7 @@ Result> AllocateBitmap(int64_t length, MemoryPool* pool) if (buf->size() > 0) { buf->mutable_data()[buf->size() - 1] = 0; } - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(buf)); + return buf; } Result> AllocateEmptyBitmap(int64_t length, MemoryPool* pool) { @@ -199,8 +197,7 @@ Result> 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(buf->size())); - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(buf)); + return buf; } Result> ConcatenateBuffers( @@ -218,8 +215,7 @@ Result> ConcatenateBuffers( out_data += buffer->size(); } } - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(out)); + return out; } } // namespace arrow diff --git a/cpp/src/arrow/compute/function_internal.h b/cpp/src/arrow/compute/function_internal.h index c95793be0aaf..d1f8d06de84d 100644 --- a/cpp/src/arrow/compute/function_internal.h +++ b/cpp/src/arrow/compute/function_internal.h @@ -706,8 +706,7 @@ const FunctionOptionsType* GetFunctionOptionsType(const Properties&... propertie auto options = std::make_unique(); RETURN_NOT_OK( FromStructScalarImpl(options.get(), scalar, properties_).status_); - // R build with openSUSE155 requires an explicit unique_ptr construction - return std::unique_ptr(std::move(options)); + return options; } std::unique_ptr Copy(const FunctionOptions& options) const override { auto out = std::make_unique(); diff --git a/cpp/src/arrow/compute/kernels/aggregate_pivot.cc b/cpp/src/arrow/compute/kernels/aggregate_pivot.cc index 50047f5ef1ce..367a9b015317 100644 --- a/cpp/src/arrow/compute/kernels/aggregate_pivot.cc +++ b/cpp/src/arrow/compute/kernels/aggregate_pivot.cc @@ -159,10 +159,7 @@ Result> PivotInit(KernelContext* ctx, const auto& options = checked_cast(*args.options); auto state = std::make_unique(); RETURN_NOT_OK(state->Init(options, args.inputs, ctx->exec_context())); - // GH-45718: This can be simplified once we drop the R openSUSE155 crossbow - // job - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::unique_ptr(std::move(state)); + return state; } Result ResolveOutputType(KernelContext* ctx, const std::vector&) { diff --git a/cpp/src/arrow/compute/kernels/hash_aggregate_internal.h b/cpp/src/arrow/compute/kernels/hash_aggregate_internal.h index 9ea4cdfcc5fd..f6462669adf0 100644 --- a/cpp/src/arrow/compute/kernels/hash_aggregate_internal.h +++ b/cpp/src/arrow/compute/kernels/hash_aggregate_internal.h @@ -55,8 +55,7 @@ Result> HashAggregateInit(KernelContext* ctx, const KernelInitArgs& args) { auto impl = std::make_unique(); RETURN_NOT_OK(impl->Init(ctx->exec_context(), args)); - // R build with openSUSE155 requires an explicit unique_ptr construction - return std::unique_ptr(std::move(impl)); + return impl; } inline Status HashAggregateResize(KernelContext* ctx, int64_t num_groups) { diff --git a/cpp/src/arrow/compute/kernels/vector_hash.cc b/cpp/src/arrow/compute/kernels/vector_hash.cc index e666f2b9f7a2..90ec9e365c35 100644 --- a/cpp/src/arrow/compute/kernels/vector_hash.cc +++ b/cpp/src/arrow/compute/kernels/vector_hash.cc @@ -533,8 +533,7 @@ Result> HashInit(KernelContext* ctx, auto result = std::make_unique(args.inputs[0].GetSharedPtr(), args.options, ctx->memory_pool()); RETURN_NOT_OK(result->Reset()); - // R build with openSUSE155 requires an explicit unique_ptr construction - return std::unique_ptr(std::move(result)); + return result; } template diff --git a/cpp/src/arrow/dataset/file_parquet.cc b/cpp/src/arrow/dataset/file_parquet.cc index 6e0b1ce5b963..ba0e93f09d40 100644 --- a/cpp/src/arrow/dataset/file_parquet.cc +++ b/cpp/src/arrow/dataset/file_parquet.cc @@ -512,8 +512,7 @@ Result> ParquetFileFormat::GetReader ARROW_ASSIGN_OR_RAISE(auto arrow_reader, parquet::arrow::FileReader::Make(options->pool, std::move(reader), std::move(arrow_properties))); - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(arrow_reader)); + return arrow_reader; } Future> ParquetFileFormat::GetReaderAsync( @@ -532,37 +531,37 @@ Future> ParquetFileFormat::GetReader source.filesystem(), options->pool); auto self = checked_pointer_cast(shared_from_this()); - return source.OpenAsync().Then([self = self, properties = std::move(properties), - source = source, options = options, metadata = metadata, - parquet_scan_options = parquet_scan_options]( - const std::shared_ptr& - input) mutable { - return parquet::ParquetFileReader::OpenAsync(input, properties, metadata) - .Then( - [=](const std::unique_ptr& reader) mutable - -> Result> { - auto arrow_properties = MakeArrowReaderProperties( - *self, *reader->metadata(), *options, *parquet_scan_options); - - ARROW_ASSIGN_OR_RAISE( - auto arrow_reader, - parquet::arrow::FileReader::Make( - options->pool, - // TODO(ARROW-12259): workaround since we have Future<(move-only - // type)> It *wouldn't* be safe to const_cast reader except that - // here we know there are no other waiters on the reader. - std::move(const_cast&>( - reader)), - arrow_properties)); - - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(arrow_reader)); - }, - [path = source.path()](const Status& status) + return source.OpenAsync().Then( + [self = self, properties = std::move(properties), source = source, + options = options, metadata = metadata, + parquet_scan_options = parquet_scan_options]( + const std::shared_ptr& input) mutable { + return parquet::ParquetFileReader::OpenAsync(input, properties, metadata) + .Then( + [=](const std::unique_ptr& reader) mutable -> Result> { - return WrapSourceError(status, path); - }); - }); + auto arrow_properties = MakeArrowReaderProperties( + *self, *reader->metadata(), *options, *parquet_scan_options); + + ARROW_ASSIGN_OR_RAISE( + auto arrow_reader, + parquet::arrow::FileReader::Make( + options->pool, + // TODO(ARROW-12259): workaround since we have Future<(move-only + // type)> It *wouldn't* be safe to const_cast reader except that + // here we know there are no other waiters on the reader. + std::move( + const_cast&>( + reader)), + arrow_properties)); + + return arrow_reader; + }, + [path = source.path()](const Status& status) + -> Result> { + return WrapSourceError(status, path); + }); + }); } struct SlicingGenerator { diff --git a/cpp/src/arrow/filesystem/s3fs.cc b/cpp/src/arrow/filesystem/s3fs.cc index cc5fb9cd66c0..1c6763a4aee9 100644 --- a/cpp/src/arrow/filesystem/s3fs.cc +++ b/cpp/src/arrow/filesystem/s3fs.cc @@ -1605,8 +1605,7 @@ class ObjectInputFile final : public io::RandomAccessFile { DCHECK_LE(bytes_read, nbytes); RETURN_NOT_OK(buf->Resize(bytes_read)); } - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(buf)); + return buf; } Result Read(int64_t nbytes, void* out) override { diff --git a/cpp/src/arrow/io/buffered.cc b/cpp/src/arrow/io/buffered.cc index 14a0fe4215eb..6b8b4b3bb9bc 100644 --- a/cpp/src/arrow/io/buffered.cc +++ b/cpp/src/arrow/io/buffered.cc @@ -452,8 +452,7 @@ class BufferedInputStream::Impl : public BufferedBase { RETURN_NOT_OK(buffer->Resize(bytes_read, false /* shrink_to_fit */)); buffer->ZeroPadding(); } - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(buffer)); + return buffer; } // For providing access to the raw file handles diff --git a/cpp/src/arrow/io/compressed.cc b/cpp/src/arrow/io/compressed.cc index 8153cab04013..c2e716157750 100644 --- a/cpp/src/arrow/io/compressed.cc +++ b/cpp/src/arrow/io/compressed.cc @@ -411,8 +411,7 @@ 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)); - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(buf)); + return buf; } const std::shared_ptr& raw() const { return raw_; } diff --git a/cpp/src/arrow/io/hdfs.cc b/cpp/src/arrow/io/hdfs.cc index c092a1ff7bca..73d8e1575721 100644 --- a/cpp/src/arrow/io/hdfs.cc +++ b/cpp/src/arrow/io/hdfs.cc @@ -172,8 +172,7 @@ class HdfsReadableFile::HdfsReadableFileImpl : public HdfsAnyFileImpl { RETURN_NOT_OK(buffer->Resize(bytes_read)); buffer->ZeroPadding(); } - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(buffer)); + return buffer; } Result Read(int64_t nbytes, void* buffer) { @@ -201,8 +200,7 @@ class HdfsReadableFile::HdfsReadableFileImpl : public HdfsAnyFileImpl { if (bytes_read < nbytes) { RETURN_NOT_OK(buffer->Resize(bytes_read)); } - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(buffer)); + return buffer; } Result GetSize() { diff --git a/cpp/src/arrow/io/stdio.cc b/cpp/src/arrow/io/stdio.cc index ba4a66a2f340..3b27838bbd1c 100644 --- a/cpp/src/arrow/io/stdio.cc +++ b/cpp/src/arrow/io/stdio.cc @@ -85,8 +85,7 @@ Result> 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(); - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(buffer)); + return buffer; } } // namespace io diff --git a/cpp/src/arrow/ipc/metadata_internal.h b/cpp/src/arrow/ipc/metadata_internal.h index 1997dfbcc453..079c56685baa 100644 --- a/cpp/src/arrow/ipc/metadata_internal.h +++ b/cpp/src/arrow/ipc/metadata_internal.h @@ -238,8 +238,7 @@ static inline Result> WriteFlatbufferBuilder( uint8_t* dst = result->mutable_data(); memcpy(dst, fbb.GetBufferPointer(), size); - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(result)); + return result; } ARROW_EXPORT diff --git a/cpp/src/arrow/ipc/reader.cc b/cpp/src/arrow/ipc/reader.cc index f8bbf6c13d37..5a0ef1179a3b 100644 --- a/cpp/src/arrow/ipc/reader.cc +++ b/cpp/src/arrow/ipc/reader.cc @@ -573,8 +573,7 @@ Result> DecompressBuffer(const std::shared_ptr& actual_decompressed); } - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(uncompressed)); + return uncompressed; } Status DecompressBuffers(Compression::type compression, const IpcReadOptions& options, diff --git a/cpp/src/arrow/ipc/writer.cc b/cpp/src/arrow/ipc/writer.cc index 749eab85d8ac..263689a648d0 100644 --- a/cpp/src/arrow/ipc/writer.cc +++ b/cpp/src/arrow/ipc/writer.cc @@ -1587,8 +1587,7 @@ Result> OpenRecordBatchWriter( auto writer = std::make_unique( std::move(sink), schema, options, /*is_file_format=*/false); RETURN_NOT_OK(writer->Start()); - // R build with openSUSE155 requires an explicit unique_ptr construction - return std::unique_ptr(std::move(writer)); + return writer; } Result> MakePayloadStreamWriter( diff --git a/cpp/src/arrow/util/align_util.cc b/cpp/src/arrow/util/align_util.cc index 4cc7675ab8c6..8c720fb295e6 100644 --- a/cpp/src/arrow/util/align_util.cc +++ b/cpp/src/arrow/util/align_util.cc @@ -166,8 +166,7 @@ Result> EnsureAlignment(std::shared_ptr buffer, auto new_buffer, AllocateBuffer(buffer->size(), minimum_desired_alignment, memory_pool)); std::memcpy(new_buffer->mutable_data(), buffer->data(), buffer->size()); - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(new_buffer)); + return new_buffer; } else { return buffer; } diff --git a/cpp/src/arrow/util/bitmap_builders.cc b/cpp/src/arrow/util/bitmap_builders.cc index 5fadddc6308b..89ccb4da0574 100644 --- a/cpp/src/arrow/util/bitmap_builders.cc +++ b/cpp/src/arrow/util/bitmap_builders.cc @@ -52,8 +52,7 @@ Result> BytesToBits(std::span bytes, uint8_t* out_buf = buffer->mutable_data(); memset(out_buf, 0, static_cast(buffer->capacity())); FillBitsFromBytes(bytes, out_buf); - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(buffer)); + return buffer; } Result> BitmapAllButOne(MemoryPool* pool, int64_t length, @@ -68,8 +67,7 @@ Result> 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); - // R build with openSUSE155 requires an explicit shared_ptr construction - return std::shared_ptr(std::move(buffer)); + return buffer; } } // namespace internal