pitrou commented on code in PR #44447:
URL: https://github.com/apache/arrow/pull/44447#discussion_r1804969824
##########
cpp/src/arrow/array/util.cc:
##########
@@ -915,6 +916,29 @@ Result<std::shared_ptr<Array>>
MakeEmptyArray(std::shared_ptr<DataType> type,
return builder->Finish();
}
+Result<std::shared_ptr<Array>> MakeMaskArray(const std::vector<int64_t>&
indices,
+ int64_t length, MemoryPool* pool)
{
+ BooleanBuilder builder(pool);
+ RETURN_NOT_OK(builder.Resize(length));
+
+ auto indices_end = indices.end();
+ auto i = indices.begin();
+ for (int64_t builder_i = 0; builder_i < length; builder_i++) {
Review Comment:
This make `length` append calls and also assumes that the indices are
ordered.
Instead, how about start from an all-false bitmap and use `SetBit` calls to
set the mask bits?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]