Skip to content

Commit

Permalink
NumericBuilder::AppendValues prevent from ub
Browse files Browse the repository at this point in the history
  • Loading branch information
mapleFU committed Nov 20, 2024
1 parent 33e8cbb commit 9e7a299
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cpp/src/arrow/array/builder_primitive.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,19 @@ class NumericBuilder
/// \return Status
Status AppendValues(const std::vector<value_type>& values,
const std::vector<bool>& is_valid) {
if (values.empty()) {
return Status::OK();
}
return AppendValues(values.data(), static_cast<int64_t>(values.size()), is_valid);
}

/// \brief Append a sequence of elements in one shot
/// \param[in] values a std::vector of values
/// \return Status
Status AppendValues(const std::vector<value_type>& values) {
if (values.empty()) {
return Status::OK();
}
return AppendValues(values.data(), static_cast<int64_t>(values.size()));
}

Expand Down

0 comments on commit 9e7a299

Please sign in to comment.