felipecrv commented on code in PR #33641:
URL: https://github.com/apache/arrow/pull/33641#discussion_r1091318594


##########
cpp/src/arrow/array/validate.cc:
##########
@@ -622,6 +637,106 @@ struct ValidateArrayImpl {
     return Status::OK();
   }
 
+  template <typename RunEndsType>
+  Status ValidateRunEndEncoded(const RunEndEncodedType& type) {
+    // overflow was already checked at this point
+    if (data.offset + data.length > std::numeric_limits<RunEndsType>::max()) {
+      return Status::Invalid(
+          "Offset + length of an REE array must fit in a value of the run ends 
type ",
+          *type.run_ends_type(), ", but offset + length was ", data.offset + 
data.length,
+          " while the allowed maximum is ", 
std::numeric_limits<RunEndsType>::max());
+    }
+    if (!data.child_data[0]) {
+      return Status::Invalid("Run ends array is null pointer");
+    }
+    if (!data.child_data[1]) {
+      return Status::Invalid("Values array is null pointer");
+    }
+    const ArrayData& run_ends_data = *data.child_data[0];
+    const ArrayData& values_data = *data.child_data[1];
+    if (*run_ends_data.type != *type.run_ends_type()) {
+      return Status::Invalid("Run ends array of ", type, " must be ",
+                             *type.run_ends_type(), ", but is ", 
*run_ends_data.type);
+    }
+    if (values_data.type != type.encoded_type()) {

Review Comment:
   Fixing...



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