Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added record bact import from/export to struct_array #336

Merged
merged 8 commits into from
Feb 4, 2025

Conversation

JohanMabille
Copy link
Collaborator

No description provided.

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.41%. Comparing base (3c020b7) to head (a98419d).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #336      +/-   ##
==========================================
- Coverage   92.08%   90.41%   -1.68%     
==========================================
  Files          83       83              
  Lines        6291     6455     +164     
==========================================
+ Hits         5793     5836      +43     
- Misses        498      619     +121     
Flag Coverage Δ
unittests 90.41% <100.00%> (-1.68%) ⬇️

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.

Comment on lines 205 to 214
std::transform(
m_array_list.cbegin(),
m_array_list.cend(),
m_name_list.begin(),
[](const array& ar)
{
return ar.name();
}
);
init_array_map();
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 move these logic to dedicated functions which returns the values to put in the members ?

Copy link
Collaborator Author

@JohanMabille JohanMabille Jan 31, 2025

Choose a reason for hiding this comment

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

I'm not sure we want to do that, this would require an additional memory allocation instead of filling the members in place. Besides, this transform is used only here. What is the issue with this implementation?

Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO it's cleaner to have only a constructor initialization list.

std::vector<name_type> get_names(const std::vector<array>& array_list)
{
    const auto names = array_list | std::views::transform(
                    [](const array& ar)
                    {
                        return ar.name();
                    }
    return std::vector<name_type> {names.begin(), names.end()};
}

  template <std::ranges::input_range CR>
        requires std::same_as<std::ranges::range_value_t<CR>, array>
    record_batch::record_batch(CR&& columns)
        : m_array_list(to_vector<array>(std::move(columns)))
        , m_name_list(get_names(m_array_list))
        , 
    {
        init_array_map(); 

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh indeed, I did not get that.

JohanMabille and others added 3 commits January 31, 2025 14:52
Co-authored-by: Alexis Placet <alexis.placet@gmail.com>
Co-authored-by: Alexis Placet <alexis.placet@gmail.com>
@JohanMabille JohanMabille force-pushed the record_batch branch 17 times, most recently from 54a3f65 to 47ad140 Compare February 4, 2025 14:11
@JohanMabille JohanMabille force-pushed the record_batch branch 2 times, most recently from 7452e85 to 43a9f58 Compare February 4, 2025 14:48
@JohanMabille JohanMabille merged commit 2fea185 into man-group:main Feb 4, 2025
69 of 70 checks passed
@JohanMabille JohanMabille deleted the record_batch branch February 4, 2025 16: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.

2 participants