You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "lidavidm (via GitHub)" <gi...@apache.org> on 2023/03/28 20:20:23 UTC

[GitHub] [arrow-nanoarrow] lidavidm commented on a diff in pull request #174: feat: Implement `ArrowArrayViewValidateFull()`

lidavidm commented on code in PR #174:
URL: https://github.com/apache/arrow-nanoarrow/pull/174#discussion_r1151110697


##########
src/nanoarrow/array.c:
##########
@@ -758,3 +804,138 @@ ArrowErrorCode ArrowArrayViewSetArray(struct ArrowArrayView* array_view,
 
   return NANOARROW_OK;
 }
+
+static int ArrowAssertIncreasingInt32(struct ArrowBufferView view,
+                                      struct ArrowError* error) {
+  if (view.size_bytes <= (int64_t)sizeof(int32_t)) {
+    return NANOARROW_OK;
+  }
+
+  for (int64_t i = 1; i < view.size_bytes / (int64_t)sizeof(int32_t); i++) {
+    int32_t diff = view.data.as_int32[i] - view.data.as_int32[i - 1];
+    if (diff < 0) {
+      ArrowErrorSet(error,
+                    "Expected element size >0 but found element size %ld at position %ld",
+                    (long)diff, (long)i);

Review Comment:
   nit: the message is kind of a non-sequitur for the error case here



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org