Skip to content

Conversation

Alex-PLACET
Copy link
Collaborator

No description provided.

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

codecov bot commented Aug 25, 2025

Codecov Report

❌ Patch coverage is 75.55556% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.21%. Comparing base (7017b2d) to head (1e6b379).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
src/layout/struct_value.cpp 28.57% 10 Missing ⚠️
src/struct_array.cpp 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #535      +/-   ##
==========================================
+ Coverage   87.97%   88.21%   +0.24%     
==========================================
  Files         100      100              
  Lines        7649     7697      +48     
==========================================
+ Hits         6729     6790      +61     
+ Misses        920      907      -13     
Flag Coverage Δ
unittests 88.21% <75.55%> (+0.24%) ⬆️

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.

@Alex-PLACET Alex-PLACET force-pushed the improve_struct_array_and_value branch from bcef271 to 681abd9 Compare September 12, 2025 13:13
@Alex-PLACET Alex-PLACET requested a review from Copilot September 12, 2025 13:13
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 improves the struct array and struct value implementation by adding name support for child arrays, bounds-checked access methods, and array manipulation capabilities.

  • Added name support to primitive arrays and struct values, allowing fields to be accessed by name
  • Implemented bounds-checked at() methods for struct values with both index and name-based access
  • Added array manipulation methods (add_child, set_child, pop_children) to enable dynamic modification of struct arrays

Reviewed Changes

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

Show a summary per file
File Description
test/test_struct_array.cpp Added comprehensive tests for new functionality including named field access and array manipulation methods
src/struct_array.cpp Implemented pop_children method and optimized iterator constructors
src/layout/struct_value.cpp Added bounds-checked at() methods and name-based field access
src/arrow_interface/arrow_array_schema_proxy.cpp Implemented set_child methods for replacing child arrays
include/sparrow/struct_array.hpp Added public interface methods for array manipulation and name access
include/sparrow/layout/struct_value.hpp Extended struct_value interface with at() methods and names() accessor
Comments suppressed due to low confidence (2)

test/test_struct_array.cpp:75

  • Typo in test case name: 'whildren' should be 'children'.
            SUBCASE("with whildren, nullable, name and metadata")

test/test_struct_array.cpp:131

  • Typo in test case name: 'whildren' should be 'children'.
            SUBCASE("with whildren, bitmap, name and metadata")

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 ready for review September 12, 2025 13:28
SPARROW_ASSERT_TRUE(child.size() == size());
auto [array, schema] = extract_arrow_structures(std::forward<A>(child));
get_arrow_proxy().set_child(index, std::move(array), std::move(schema));
m_children = make_children();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we avoid rebuilding the whole children list, and just rebuild the one we changed?


auto struct_value::operator[](size_type i) const -> const_reference
{
SPARROW_ASSERT_TRUE(i < size());
Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with copilot, this should be removed, or we should change the definition of https://github.com/man-group/sparrow/blob/main/include/sparrow/utils/contracts.hpp#L172 and set it to 0 by default (and to 1 when building in DEBUG).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We have this assert in all the other classes

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah indeed, that should be addressed in a dedicated PR

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 5 out of 5 changed files in this pull request and generated 2 comments.


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

{
if constexpr (std::is_same_v<std::decay_t<decltype(val1)>, nullable_uint8_t>)
{
CHECK_EQ(val1.value(), static_cast<inner_scalar_type>(i));
Copy link

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

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

The cast to inner_scalar_type is incorrect here. The variable val1 is of type nullable_uint8_t (as shown in line 279), so it should be cast to std::uint8_t instead of inner_scalar_type.

Suggested change
CHECK_EQ(val1.value(), static_cast<inner_scalar_type>(i));
CHECK_EQ(val1.value(), static_cast<std::uint8_t>(i));

Copilot uses AI. Check for mistakes.

{
SPARROW_ASSERT_TRUE(child.size() == size());
}
m_children.reserve(m_children.size() + children.size());
Copy link

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

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

The children.size() call may be inefficient for input ranges that don't have constant-time size computation. Consider using std::ranges::distance or iterating without pre-reservation for generic input ranges.

Suggested change
m_children.reserve(m_children.size() + children.size());
m_children.reserve(m_children.size() + std::ranges::distance(children));

Copilot uses AI. Check for mistakes.

@JohanMabille JohanMabille merged commit 64677f6 into man-group:main Oct 3, 2025
154 of 155 checks passed
@Alex-PLACET Alex-PLACET deleted the improve_struct_array_and_value branch October 9, 2025 09:16
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