-
Notifications
You must be signed in to change notification settings - Fork 20
Add binary and string view to integration tests #455
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 binary and string view to integration tests #455
Conversation
63e5ca7
to
b6c4daa
Compare
include/sparrow/utils/ranges.hpp
Outdated
constexpr bool operator==(const std::span<T, N1>& lhs, const std::span<T, N2>& rhs) | ||
{ | ||
return std::ranges::equal(lhs, rhs); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding new functions into std
namespace is undefined behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, now the == nullable operator use deep comparison for std::span
inline constexpr std::string_view SIZE = "SIZE"; | ||
inline constexpr std::string_view INLINED = "INLINED"; | ||
inline constexpr std::string_view PREFIX_HEX = "PREFIX_HEX"; | ||
inline constexpr std::string_view BUFFER_INDEX = "BUFFER_INDEX"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking: constexpr
implies inline
, so inline can be removed here, and from the previous lines too (sorry for not catching it earlier).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I was wrong, constexpr implies inline for functions only, not for variables, sorry for that.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #455 +/- ##
==========================================
- Coverage 88.29% 88.25% -0.05%
==========================================
Files 100 100
Lines 7410 7433 +23
==========================================
+ Hits 6543 6560 +17
- Misses 867 873 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
455f61c
to
a0934a9
Compare
950abe1
to
7c690f9
Compare
There was a problem hiding this 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 integration tests for binary and string view handling by introducing new parser implementations and updating associated test and build files.
- Added binaryview_parser and utf8view_array_from_json functions to parse binary and utf8 view data.
- Removed the old stringview_parser and updated the test JSON file list and build system to support the new view types.
Reviewed Changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
test/c_data_integration/test_c_data_integration/test_c_data_integration.cpp | Updated test JSON file paths and ordering to include binary view tests. |
test/c_data_integration/src/utils.cpp | Added a new hex_string_to_bytes function and refactored related code. |
test/c_data_integration/src/json_parser.cpp | Updated to include binaryview_parser and remapped "utf8view" to utf8view_array_from_json. |
test/c_data_integration/src/binaryview_parser.cpp | Added a new parser implementation for binary and utf8 view arrays. |
test/c_data_integration/CMakeLists.txt | Updated to include the new binaryview_parser and remove the deprecated stringview_parser. |
src/array_factory.cpp | Added support for STRING_VIEW and BINARY_VIEW data types. |
Other header files | Updated types, traits, and layout interfaces to support and integrate the new view types. |
Comments suppressed due to low confidence (2)
include/sparrow/types/data_type.hpp:681
- The removal of std::string_view from all_base_types_extended_t alters the extended type set. Please confirm that this change is deliberate, as it could affect type trait resolutions elsewhere.
using all_base_types_extended_t = mpl::append_t<all_base_types_t, char>;
test/c_data_integration/test_c_data_integration/test_c_data_integration.cpp:51
- There appear to be duplicate JSON file paths from different positions in the list. Please verify that the ordering and duplication of file entries is intentional to avoid redundant test executions.
json_files_path / "null-trivial.json",
view_data.end(), | ||
buffer.begin() + offset, | ||
buffer.begin() + offset + size - static_cast<int>(prefix_bytes.size()) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calculation for the insertion range might result in an invalid range if prefix_bytes.size() exceeds size. Consider adding a validation check to ensure that 'offset + size' is not less than prefix_bytes.size().
Copilot uses AI. Check for mistakes.
d889e9b
to
01f150e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized the value_type of variable_size_binary_view
is either a std::string_view
or a sequence_view
. I think it should be the same as variable_size_binary_array
, that is, std::string
or std::vector<std::byte>.
std::stirng_viewand
sequence_view` should be used for const_reference types only.
include/sparrow/types/data_type.hpp
Outdated
std::vector<byte_t>, | ||
sparrow::sequence_view<const byte_t>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all_base_types_t
should contain types for the inner value_type only, not types used in the const_reference type.,
static constexpr data_type type_id = data_type::STRING_VIEW; | ||
using value_type = std::string_view; | ||
using const_reference = std::string_view; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for the traits, they should be defined for types participating in the value_type variant, not types participating in the const_reference variant.
include/sparrow/utils/nullable.hpp
Outdated
requires( | ||
mpl::is_type_instance_of_v<std::ranges::range_value_t<R>, nullable> | ||
&& std::is_same_v<typename std::ranges::range_value_t<R>::value_type, T> | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change? nullable_of
is easier to read.
include/sparrow/utils/nullable.hpp
Outdated
requires( | ||
mpl::is_type_instance_of_v<std::ranges::range_value_t<R>, nullable> | ||
&& std::is_same_v<typename std::ranges::range_value_t<R>::value_type, T> | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
77a470e
to
434ee7e
Compare
bfd6717
to
46f9840
Compare
46f9840
to
df8d61c
Compare
36a2399
to
fdd65b4
Compare
5c4577a
to
a35f125
Compare
for more information, see https://pre-commit.ci
No description provided.