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-44581: [C++] Minor: ArrayData ctor can assign null_count directly #44582

Merged
merged 2 commits into from
Oct 31, 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
14 changes: 6 additions & 8 deletions cpp/src/arrow/array/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,25 +150,23 @@ struct ARROW_EXPORT ArrayData {
ArrayData(ArrayData&& other) noexcept
: type(std::move(other.type)),
length(other.length),
null_count(other.null_count.load()),
offset(other.offset),
buffers(std::move(other.buffers)),
child_data(std::move(other.child_data)),
dictionary(std::move(other.dictionary)),
statistics(std::move(other.statistics)) {
SetNullCount(other.null_count);
}
statistics(std::move(other.statistics)) {}

// Copy constructor
ArrayData(const ArrayData& other) noexcept
: type(other.type),
length(other.length),
null_count(other.null_count.load()),
offset(other.offset),
buffers(other.buffers),
child_data(other.child_data),
dictionary(other.dictionary),
statistics(other.statistics) {
SetNullCount(other.null_count);
}
statistics(other.statistics) {}

// Move assignment
ArrayData& operator=(ArrayData&& other) {
Expand Down Expand Up @@ -324,7 +322,7 @@ struct ARROW_EXPORT ArrayData {

/// \brief Return true if the validity bitmap may have 0's in it, or if the
/// child arrays (in the case of types without a validity bitmap) may have
/// nulls, or if the dictionary of dictionay array may have nulls.
/// nulls, or if the dictionary of dictionary array may have nulls.
///
/// This is not a drop-in replacement for MayHaveNulls, as historically
/// MayHaveNulls() has been used to check for the presence of a validity
Expand Down Expand Up @@ -639,7 +637,7 @@ struct ARROW_EXPORT ArraySpan {
bool HasVariadicBuffers() const;

private:
ARROW_FRIEND_EXPORT friend bool internal::IsNullRunEndEncoded(const ArrayData& span,
ARROW_FRIEND_EXPORT friend bool internal::IsNullRunEndEncoded(const ArrayData& data,
int64_t i);

bool IsNullSparseUnion(int64_t i) const;
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/extension_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class ARROW_EXPORT ExtensionType : public DataType {

protected:
explicit ExtensionType(std::shared_ptr<DataType> storage_type)
: DataType(Type::EXTENSION), storage_type_(storage_type) {}
: DataType(Type::EXTENSION), storage_type_(std::move(storage_type)) {}

std::shared_ptr<DataType> storage_type_;
};
Expand Down
Loading