Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-43992: [C++] Add missing std::move() in array_nested.cc #43993

Merged
merged 1 commit into from
Sep 6, 2024
Merged
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
4 changes: 2 additions & 2 deletions cpp/src/arrow/array/array_dict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ class DictionaryUnifierImpl : public DictionaryUnifier {
using MemoTableType = typename DictTraits::MemoTableType;

DictionaryUnifierImpl(MemoryPool* pool, std::shared_ptr<DataType> value_type)
: pool_(pool), value_type_(value_type), memo_table_(pool) {}
: pool_(pool), value_type_(std::move(value_type)), memo_table_(pool) {}

Status Unify(const Array& dictionary, std::shared_ptr<Buffer>* out) override {
if (dictionary.null_count() > 0) {
Expand Down Expand Up @@ -432,7 +432,7 @@ struct MakeUnifier {
std::unique_ptr<DictionaryUnifier> result;

MakeUnifier(MemoryPool* pool, std::shared_ptr<DataType> value_type)
: pool(pool), value_type(value_type) {}
: pool(pool), value_type(std::move(value_type)) {}

template <typename T>
enable_if_no_memoize<T, Status> Visit(const T&) {
Expand Down
41 changes: 21 additions & 20 deletions cpp/src/arrow/array/array_nested.cc
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ Result<std::shared_ptr<ListArray>> ListArray::FromArrays(
const Array& offsets, const Array& values, MemoryPool* pool,
std::shared_ptr<Buffer> null_bitmap, int64_t null_count) {
return ListArrayFromArrays<ListType>(std::make_shared<ListType>(values.type()), offsets,
values, pool, null_bitmap, null_count);
values, pool, std::move(null_bitmap), null_count);
}

Result<std::shared_ptr<ListArray>> ListArray::FromListView(const ListViewArray& source,
Expand All @@ -563,7 +563,7 @@ Result<std::shared_ptr<ListArray>> ListArray::FromArrays(
return Status::TypeError("Mismatching list value type");
}
return ListArrayFromArrays<ListType>(std::move(type), offsets, values, pool,
null_bitmap, null_count);
std::move(null_bitmap), null_count);
}

Result<std::shared_ptr<Array>> ListArray::Flatten(MemoryPool* memory_pool) const {
Expand Down Expand Up @@ -599,8 +599,8 @@ Result<std::shared_ptr<LargeListArray>> LargeListArray::FromArrays(
const Array& offsets, const Array& values, MemoryPool* pool,
std::shared_ptr<Buffer> null_bitmap, int64_t null_count) {
return ListArrayFromArrays<LargeListType>(
std::make_shared<LargeListType>(values.type()), offsets, values, pool, null_bitmap,
null_count);
std::make_shared<LargeListType>(values.type()), offsets, values, pool,
std::move(null_bitmap), null_count);
}

Result<std::shared_ptr<LargeListArray>> LargeListArray::FromListView(
Expand All @@ -622,7 +622,7 @@ Result<std::shared_ptr<LargeListArray>> LargeListArray::FromArrays(
return Status::TypeError("Mismatching list value type");
}
return ListArrayFromArrays<LargeListType>(std::move(type), offsets, values, pool,
null_bitmap, null_count);
std::move(null_bitmap), null_count);
}

Result<std::shared_ptr<Array>> LargeListArray::Flatten(MemoryPool* memory_pool) const {
Expand Down Expand Up @@ -662,7 +662,7 @@ Result<std::shared_ptr<ListViewArray>> ListViewArray::FromArrays(
std::shared_ptr<Buffer> null_bitmap, int64_t null_count) {
return ListViewArrayFromArrays<ListViewType>(
std::make_shared<ListViewType>(values.type()), offsets, sizes, values, pool,
null_bitmap, null_count);
std::move(null_bitmap), null_count);
}

Result<std::shared_ptr<ListViewArray>> ListViewArray::FromArrays(
Expand All @@ -677,7 +677,7 @@ Result<std::shared_ptr<ListViewArray>> ListViewArray::FromArrays(
return Status::TypeError("Mismatching list-view value type");
}
return ListViewArrayFromArrays<ListViewType>(std::move(type), offsets, sizes, values,
pool, null_bitmap, null_count);
pool, std::move(null_bitmap), null_count);
}

Result<std::shared_ptr<ListViewArray>> ListViewArray::FromList(const ListArray& source,
Expand Down Expand Up @@ -722,7 +722,7 @@ LargeListViewArray::LargeListViewArray(std::shared_ptr<DataType> type, int64_t l
std::shared_ptr<Buffer> null_bitmap,
int64_t null_count, int64_t offset) {
LargeListViewArray::SetData(ArrayData::Make(
type, length,
std::move(type), length,
{std::move(null_bitmap), std::move(value_offsets), std::move(value_sizes)},
/*child_data=*/{values->data()}, null_count, offset));
}
Expand All @@ -737,7 +737,7 @@ Result<std::shared_ptr<LargeListViewArray>> LargeListViewArray::FromArrays(
std::shared_ptr<Buffer> null_bitmap, int64_t null_count) {
return ListViewArrayFromArrays<LargeListViewType>(
std::make_shared<LargeListViewType>(values.type()), offsets, sizes, values, pool,
null_bitmap, null_count);
std::move(null_bitmap), null_count);
}

Result<std::shared_ptr<LargeListViewArray>> LargeListViewArray::FromArrays(
Expand All @@ -752,7 +752,7 @@ Result<std::shared_ptr<LargeListViewArray>> LargeListViewArray::FromArrays(
return Status::TypeError("Mismatching large list-view value type");
}
return ListViewArrayFromArrays<LargeListViewType>(
std::move(type), offsets, sizes, values, pool, null_bitmap, null_count);
std::move(type), offsets, sizes, values, pool, std::move(null_bitmap), null_count);
}

Result<std::shared_ptr<Array>> LargeListViewArray::Flatten(
Expand Down Expand Up @@ -854,8 +854,9 @@ Result<std::shared_ptr<Array>> MapArray::FromArraysInternal(
null_count = kUnknownNullCount;
}
buffers[1] = typed_offsets.values();
return std::make_shared<MapArray>(type, offsets->length() - 1, std::move(buffers), keys,
items, /*null_count=*/null_count, offsets->offset());
return std::make_shared<MapArray>(std::move(type), offsets->length() - 1,
std::move(buffers), keys, items,
/*null_count=*/null_count, offsets->offset());
}

Result<std::shared_ptr<Array>> MapArray::FromArrays(const std::shared_ptr<Array>& offsets,
Expand Down Expand Up @@ -971,8 +972,8 @@ Result<std::shared_ptr<Array>> FixedSizeListArray::FromArrays(
int64_t length = values->length() / list_size;
auto list_type = std::make_shared<FixedSizeListType>(values->type(), list_size);

return std::make_shared<FixedSizeListArray>(list_type, length, values, null_bitmap,
null_count);
return std::make_shared<FixedSizeListArray>(list_type, length, values,
std::move(null_bitmap), null_count);
}

Result<std::shared_ptr<Array>> FixedSizeListArray::FromArrays(
Expand All @@ -992,8 +993,8 @@ Result<std::shared_ptr<Array>> FixedSizeListArray::FromArrays(
}
int64_t length = values->length() / list_type.list_size();

return std::make_shared<FixedSizeListArray>(type, length, values, null_bitmap,
null_count);
return std::make_shared<FixedSizeListArray>(std::move(type), length, values,
std::move(null_bitmap), null_count);
}

Result<std::shared_ptr<Array>> FixedSizeListArray::Flatten(
Expand All @@ -1015,7 +1016,7 @@ StructArray::StructArray(const std::shared_ptr<DataType>& type, int64_t length,
std::shared_ptr<Buffer> null_bitmap, int64_t null_count,
int64_t offset) {
ARROW_CHECK_EQ(type->id(), Type::STRUCT);
SetData(ArrayData::Make(type, length, {null_bitmap}, null_count, offset));
SetData(ArrayData::Make(type, length, {std::move(null_bitmap)}, null_count, offset));
for (const auto& child : children) {
data_->child_data.push_back(child->data());
}
Expand Down Expand Up @@ -1048,7 +1049,7 @@ Result<std::shared_ptr<StructArray>> StructArray::Make(
null_count = 0;
}
return std::make_shared<StructArray>(struct_(fields), length - offset, children,
null_bitmap, null_count, offset);
std::move(null_bitmap), null_count, offset);
}

Result<std::shared_ptr<StructArray>> StructArray::Make(
Expand Down Expand Up @@ -1085,8 +1086,8 @@ const std::shared_ptr<Array>& StructArray::field(int i) const {
} else {
field_data = data_->child_data[i];
}
std::shared_ptr<Array> result = MakeArray(field_data);
std::atomic_store(&boxed_fields_[i], result);
result = MakeArray(field_data);
std::atomic_store(&boxed_fields_[i], std::move(result));
return boxed_fields_[i];
}
return boxed_fields_[i];
Expand Down
Loading