Skip to content

Conversation

Alex-PLACET
Copy link
Collaborator

No description provided.

@Alex-PLACET Alex-PLACET self-assigned this Aug 19, 2025
@codecov
Copy link

codecov bot commented Aug 19, 2025

Codecov Report

❌ Patch coverage is 91.37931% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.44%. Comparing base (4b5478a) to head (666a426).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...nclude/sparrow/variable_size_binary_view_array.hpp 91.32% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #526      +/-   ##
==========================================
+ Coverage   88.27%   88.44%   +0.17%     
==========================================
  Files         100      100              
  Lines        7709     7886     +177     
==========================================
+ Hits         6805     6975     +170     
- Misses        904      911       +7     
Flag Coverage Δ
unittests 88.44% <91.37%> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds mutation support to the variable size binary view array implementation, enabling resize, insert, and erase operations. The implementation provides comprehensive mutating functionality while managing the complex storage layout of binary view arrays with their inline storage optimization for strings ≤12 bytes.

Key changes:

  • Adds assignment, resize, insert, and erase methods to the binary view array
  • Implements comprehensive test coverage for all mutation operations
  • Fixes assertion logic in the base class to allow empty range operations

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
include/sparrow/variable_size_binary_view_array.hpp Adds mutating methods (assign, resize_values, insert_value, insert_values, erase_values) with complex buffer management logic
include/sparrow/layout/mutable_array_base.hpp Fixes assertion to allow empty range erases (first == last)
test/test_variable_size_binary_view_array.cpp Comprehensive test suite covering all mutation scenarios including edge cases

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Alex-PLACET Alex-PLACET marked this pull request as draft August 25, 2025 07:39
@Alex-PLACET Alex-PLACET requested a review from Copilot October 9, 2025 11:38
@Alex-PLACET Alex-PLACET marked this pull request as ready for review October 9, 2025 11:38
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

*dest = static_cast<std::uint8_t>(*src_it);
++src_it;
++dest;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about simplifying the implementation with something like:

std::ranges::transform(range, dest, to_uint8_transform());

And since it's a single line, I think calls to copy_and_convert_to_uint8 could actually be replaced with that single line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

++src_it;
++dest;
++copied;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation could be simplified with something like:

std::ranges::transform(range | std::views::take(count), dest, to_uint8_transform());

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Alex-PLACET Alex-PLACET force-pushed the add_mutability_binary_view branch from ccf0660 to c90061e Compare October 17, 2025 08:17
@Alex-PLACET Alex-PLACET linked an issue Oct 17, 2025 that may be closed by this pull request
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

std::size_t write_offset = 0;

// Create mapping of old offsets to new offsets
std::unordered_map<std::size_t, std::size_t> offset_mapping;
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using std::unordered_map for offset mapping in the erase operation could be inefficient for arrays with many long strings. Consider using a sorted vector of pairs with binary search, or pre-allocate the map with an appropriate bucket count.

Suggested change
std::unordered_map<std::size_t, std::size_t> offset_mapping;
std::unordered_map<std::size_t, std::size_t> offset_mapping;
offset_mapping.reserve(current_size - count);

Copilot uses AI. Check for mistakes.

Comment on lines 1040 to 1046
auto transformed = rhs
| std::ranges::views::transform(
transform_to<typename T::value_type, typename T::value_type>
);

std::ranges::copy(transformed, reinterpret_cast<typename T::value_type*>(data_ptr));

Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The transform operation from T::value_type to T::value_type is redundant. This identity transformation adds unnecessary overhead and should be removed.

Suggested change
auto transformed = rhs
| std::ranges::views::transform(
transform_to<typename T::value_type, typename T::value_type>
);
std::ranges::copy(transformed, reinterpret_cast<typename T::value_type*>(data_ptr));
// Directly copy rhs into the data pointer, as transform is redundant
std::ranges::copy(rhs, reinterpret_cast<typename T::value_type*>(data_ptr));

Copilot uses AI. Check for mistakes.

@JohanMabille JohanMabille merged commit ce49b12 into man-group:main Oct 17, 2025
155 checks passed
@Alex-PLACET Alex-PLACET deleted the add_mutability_binary_view branch October 17, 2025 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Made binary/string view mutable

2 participants