wesm commented on a change in pull request #7596:
URL: https://github.com/apache/arrow/pull/7596#discussion_r450548152



##########
File path: cpp/src/arrow/array/array_binary.cc
##########
@@ -24,11 +24,27 @@
 #include "arrow/type.h"
 #include "arrow/util/checked_cast.h"
 #include "arrow/util/logging.h"
+#include "arrow/util/utf8.h"
 
 namespace arrow {
 
 using internal::checked_cast;
 
+namespace {
+
+template <typename StringArrayType>
+Status ValidateStringData(const StringArrayType& array) {
+  util::InitializeUTF8();
+  for (int64_t i = 0; i < array.length(); ++i) {
+    if (!array.IsNull(i) && !util::ValidateUTF8(array.GetView(i))) {
+      return Status::Invalid("Invalid UTF8 sequence at string index ", i);
+    }
+  }
+  return Status::OK();
+}

Review comment:
       If this became a perf bottleneck, this would be pretty easy to speed up




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

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


Reply via email to