Skip to content

Commit

Permalink
lint cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
amol- committed Oct 16, 2024
1 parent ef8dfb2 commit 5f995cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
9 changes: 4 additions & 5 deletions cpp/src/arrow/array/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -916,18 +916,17 @@ 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* memory_pool) {
Result<std::shared_ptr<Array>> MakeMaskArray(const std::vector<int64_t>& indices,
int64_t length, MemoryPool* memory_pool) {
BooleanBuilder builder(memory_pool);
RETURN_NOT_OK(builder.Resize(length));

auto i = indices.begin();
for(int64_t builder_i = 0; builder_i < length; builder_i++) {
for (int64_t builder_i = 0; builder_i < length; builder_i++) {
if (builder_i == *i) {
builder.UnsafeAppend(true);
i++;
}
else {
} else {
builder.UnsafeAppend(false);
}
}
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/array/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ ARROW_EXPORT
Result<std::shared_ptr<Array>> MakeEmptyArray(std::shared_ptr<DataType> type,
MemoryPool* pool = default_memory_pool());


/// \brief Create an Array representing a boolean mask
///
/// The mask will have all elements set to false except for those
Expand All @@ -80,8 +79,9 @@ Result<std::shared_ptr<Array>> MakeEmptyArray(std::shared_ptr<DataType> type,
/// \param[in] pool the memory pool to allocate memory from
/// \return the resulting Array
ARROW_EXPORT
Result<std::shared_ptr<Array>> MakeMaskArray(const std::vector<int64_t> &indices, int64_t length,
MemoryPool* memory_pool = default_memory_pool());
Result<std::shared_ptr<Array>> MakeMaskArray(
const std::vector<int64_t>& indices, int64_t length,
MemoryPool* memory_pool = default_memory_pool());
/// @}

namespace internal {
Expand Down
2 changes: 1 addition & 1 deletion python/pyarrow/tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -4207,4 +4207,4 @@ def test_non_cpu_array():
def test_mask_array():
expected = pa.array([False, False, True, False, True, False])
mask_array = pa.mask([2, 4], 6)
assert mask_array.equals(expected)
assert mask_array.equals(expected)

0 comments on commit 5f995cb

Please sign in to comment.