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

Add name metadata convenient constructors #310

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Alex-PLACET
Copy link
Collaborator

@Alex-PLACET Alex-PLACET commented Dec 13, 2024

Sorry there is a lot of formatting, please ignore the whitespaces in the viewer's settings

@Alex-PLACET Alex-PLACET force-pushed the add_name_metadata_convenient_constructors branch 2 times, most recently from 181e3f3 to bc6077d Compare December 16, 2024 09:14
@Alex-PLACET Alex-PLACET self-assigned this Dec 16, 2024
@Alex-PLACET Alex-PLACET marked this pull request as ready for review December 16, 2024 09:27
@Alex-PLACET Alex-PLACET force-pushed the add_name_metadata_convenient_constructors branch 4 times, most recently from 7d7b645 to 81fddde Compare December 18, 2024 14:26
@codecov-commenter
Copy link

codecov-commenter commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 95.78947% with 4 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@c015596). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/run_encoded_array.cpp 55.55% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #310   +/-   ##
=======================================
  Coverage        ?   91.87%           
=======================================
  Files           ?       77           
  Lines           ?     5770           
  Branches        ?        0           
=======================================
  Hits            ?     5301           
  Misses          ?      469           
  Partials        ?        0           
Flag Coverage Δ
unittests 91.87% <95.78%> (?)

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.

Copy link
Collaborator

@JohanMabille JohanMabille left a comment

Choose a reason for hiding this comment

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

It is usually more flexible to take arguments by value rather than by rvalue reference, at least in the public APIs (this way the user can decide to move or to copy), except if you explicitly want to to force the user to move (which I don't think is the case here). Doing the same in private APIs would be consistent, although not strictly required.

inline null_array::null_array(
size_t length,
std::optional<std::string_view>&& name,
std::optional<std::string_view>&& metadata
Copy link
Collaborator

Choose a reason for hiding this comment

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

These arguments should be passed by value so that the user can decide to copy or move.

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

inline arrow_proxy null_array::create_proxy(
size_t length,
std::optional<std::string_view>&& name,
std::optional<std::string_view>&& metadata
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, prefer arguments by value rather than by rvalue reference.

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

ArrowSchema schema = make_arrow_schema(
"n"sv,
std::forward<std::optional<std::string_view>>(name),
std::forward<std::optional<std::string_view>>(metadata),
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's not a deducing context, so no need for std::forward here. Prefer moving the arguments instead (or passing them by value if you need them later in the function).

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

R&& values,
VB&& validity_input,
std::optional<std::string_view>&& name,
std::optional<std::string_view>&& metadata
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here.

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

std::move(offset_buffer),
std::forward<VB>(validity_input),
std::forward<std::optional<std::string_view>>(name),
std::forward<std::optional<std::string_view>>(metadata)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Prefer std::move here.

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

arrow_proxy variable_size_binary_array_impl<T, CR, OT>::create_proxy(
R&& range,
std::optional<std::string_view>&& name,
std::optional<std::string_view>&& metadata
Copy link
Collaborator

Choose a reason for hiding this comment

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

The 2 last arguments should be taken by value.

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

values,
is_non_null,
std::forward<std::optional<std::string_view>>(name),
std::forward<std::optional<std::string_view>>(metadata)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Prefer std::move here.

R&& range,
VB&& bitmap_input = validity_bitmap{},
std::optional<std::string_view>&& name = std::nullopt,
std::optional<std::string_view>&& metadata = std::nullopt
Copy link
Collaborator

Choose a reason for hiding this comment

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

The 2 last arguments should be taken by value

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_name_metadata_convenient_constructors branch from 747bddf to fb4075b Compare December 20, 2024 12:15
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.

3 participants