paleolimbot commented on code in PR #578:
URL: https://github.com/apache/arrow-nanoarrow/pull/578#discussion_r1710214948


##########
src/nanoarrow/nanoarrow.h:
##########
@@ -1064,6 +1065,19 @@ ArrowErrorCode ArrowArrayViewValidate(struct 
ArrowArrayView* array_view,
                                       enum ArrowValidationLevel 
validation_level,
                                       struct ArrowError* error);
 
+/// \brief Compare two ArrowArrayView objects for equality
+///
+/// Given two ArrowArrayView instances, place either 0 (not equal) and
+/// 1 (equal) at the address pointed to by out. If the comparison determines
+/// that actual and expected are not equal, a reason will be communicated via
+/// error if error is non-NULL.
+///
+/// Returns NANOARROW_OK if the comparison completed successfully.
+ArrowErrorCode ArrowArrayViewCompare(const struct ArrowArrayView* actual,
+                                     const struct ArrowArrayView* expected,
+                                     enum ArrowCompareLevel level, int* out,
+                                     struct ArrowError* error);

Review Comment:
   > This should probably not be an ArrowError since it isn't 
really/necessarily communicating an error
   
   Good point! Maybe `ArrowError* explanation`? I am not all that worried about 
the explanation being longer than 1023 bytes since the only place where it's 
uncertain if it will fit is the nesting level and it would take an absolutely 
insane nesting level to max out the error space (and the insanity of the 
nesting would at least be evident). If we were materializing elements it might 
be a problem (but communicating the where with a fixed-size message is probably 
OK).
   
   > For another thing, it might be desirable to add NANOARROW_COMPARE_DIFF 
later
   
   I was thinking that if this function could communicate the location of the 
first difference, some C++ or Python might be a good fit for using that to 
generate a more useful message (maybe with the help of some of the cool gmock 
range matchers!)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to