Skip to content

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

Conversation

Alex-PLACET
Copy link
Collaborator

No description provided.

@Alex-PLACET Alex-PLACET self-assigned this Jun 18, 2025
@Alex-PLACET Alex-PLACET requested a review from Copilot June 18, 2025 15:48
Copilot

This comment was marked as outdated.

@Alex-PLACET Alex-PLACET force-pushed the add_binary_view_c_data_structure_integration_tests branch from 63e5ca7 to b6c4daa Compare June 20, 2025 12:37
constexpr bool operator==(const std::span<T, N1>& lhs, const std::span<T, N2>& rhs)
{
return std::ranges::equal(lhs, rhs);
}
Copy link
Collaborator

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.

Copy link
Collaborator Author

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";
Copy link
Collaborator

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Collaborator

@JohanMabille JohanMabille Jul 1, 2025

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.

Copy link

codecov bot commented Jun 20, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.

Project coverage is 88.25%. Comparing base (8ce3116) to head (9f8d160).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/array_factory.cpp 0.00% 2 Missing ⚠️
include/sparrow/layout/dispatch.hpp 50.00% 1 Missing ⚠️
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     
Flag Coverage Δ
unittests 88.25% <66.66%> (-0.05%) ⬇️

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 marked this pull request as ready for review June 20, 2025 13:53
@Alex-PLACET Alex-PLACET force-pushed the add_binary_view_c_data_structure_integration_tests branch from 455f61c to a0934a9 Compare June 20, 2025 13:56
@Alex-PLACET Alex-PLACET force-pushed the add_binary_view_c_data_structure_integration_tests branch 3 times, most recently from 950abe1 to 7c690f9 Compare June 24, 2025 07:40
@Alex-PLACET Alex-PLACET requested a review from Copilot June 24, 2025 09:31
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 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())
);
Copy link
Preview

Copilot AI Jun 24, 2025

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.

@Alex-PLACET Alex-PLACET force-pushed the add_binary_view_c_data_structure_integration_tests branch 3 times, most recently from d889e9b to 01f150e Compare July 1, 2025 13:23
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.

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_viewandsequence_view` should be used for const_reference types only.

std::vector<byte_t>,
sparrow::sequence_view<const byte_t>,
Copy link
Collaborator

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;
};
Copy link
Collaborator

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.

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>
)
Copy link
Collaborator

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.

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

@Alex-PLACET Alex-PLACET force-pushed the add_binary_view_c_data_structure_integration_tests branch 2 times, most recently from 77a470e to 434ee7e Compare July 4, 2025 06:50
@JohanMabille JohanMabille force-pushed the add_binary_view_c_data_structure_integration_tests branch from bfd6717 to 46f9840 Compare July 4, 2025 12:22
@JohanMabille JohanMabille force-pushed the add_binary_view_c_data_structure_integration_tests branch from 46f9840 to df8d61c Compare July 4, 2025 12:46
@JohanMabille JohanMabille force-pushed the add_binary_view_c_data_structure_integration_tests branch 2 times, most recently from 36a2399 to fdd65b4 Compare July 8, 2025 07:45
@JohanMabille JohanMabille force-pushed the add_binary_view_c_data_structure_integration_tests branch from 5c4577a to a35f125 Compare July 8, 2025 07:52
@JohanMabille JohanMabille merged commit 1fce28a into man-group:main Jul 8, 2025
166 of 168 checks passed
@Alex-PLACET Alex-PLACET deleted the add_binary_view_c_data_structure_integration_tests branch July 8, 2025 12:39
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