Skip to content

Conversation

Alex-PLACET
Copy link
Collaborator

No description provided.

@Alex-PLACET Alex-PLACET self-assigned this Aug 19, 2025
pre-commit-ci bot and others added 5 commits August 19, 2025 10:46
Copy link

codecov bot commented Aug 19, 2025

Codecov Report

❌ Patch coverage is 91.13300% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.37%. Comparing base (7e1a023) to head (cd5c563).
⚠️ Report is 39 commits behind head on main.

Files with missing lines Patch % Lines
...nclude/sparrow/variable_size_binary_view_array.hpp 91.08% 18 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #526      +/-   ##
==========================================
+ Coverage   88.11%   88.37%   +0.26%     
==========================================
  Files         100      100              
  Lines        7470     7888     +418     
==========================================
+ Hits         6582     6971     +389     
- Misses        888      917      +29     
Flag Coverage Δ
unittests 88.37% <91.13%> (+0.26%) ⬆️

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.

Comment on lines +1233 to +1239
*reinterpret_cast<std::int32_t*>(view_ptr + BUFFER_INDEX_OFFSET) = static_cast<std::int32_t>(
FIRST_VAR_DATA_BUFFER_INDEX
);

*reinterpret_cast<std::int32_t*>(view_ptr + BUFFER_OFFSET_OFFSET) = static_cast<std::int32_t>(
final_offset
);
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

These lines use reinterpret_cast for writing int32 values, which is inconsistent with the safe unaligned write helper function 'write_int32_unaligned' that was introduced and used elsewhere in the code. Use the helper function for consistency and safety.

Suggested change
*reinterpret_cast<std::int32_t*>(view_ptr + BUFFER_INDEX_OFFSET) = static_cast<std::int32_t>(
FIRST_VAR_DATA_BUFFER_INDEX
);
*reinterpret_cast<std::int32_t*>(view_ptr + BUFFER_OFFSET_OFFSET) = static_cast<std::int32_t>(
final_offset
);
write_int32_unaligned(view_ptr + BUFFER_INDEX_OFFSET, static_cast<std::int32_t>(
FIRST_VAR_DATA_BUFFER_INDEX
));
write_int32_unaligned(view_ptr + BUFFER_OFFSET_OFFSET, static_cast<std::int32_t>(
final_offset
));

Copilot uses AI. Check for mistakes.

*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.

++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());

);
auto val_casted = val | std::ranges::views::transform(to_uint8_transform());

sparrow::ranges::copy(val_casted, long_string_storage.data() + long_string_storage_offset);
Copy link
Collaborator

Choose a reason for hiding this comment

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

These two lines are equivalent to copy_and_convert_to_uint8(val, long_string_storage.data() + long_string_storage_offset). Or you can keep them as is if you decide to remove the copy_and_convert_to_uint8 function.

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.

2 participants