zeroshade commented on code in PR #36489:
URL: https://github.com/apache/arrow/pull/36489#discussion_r1254571451


##########
cpp/src/arrow/c/bridge.cc:
##########
@@ -663,6 +672,115 @@ Status ExportRecordBatch(const RecordBatch& batch, struct 
ArrowArray* out,
   return Status::OK();
 }
 
+//////////////////////////////////////////////////////////////////////////
+// C device arrays
+
+Result<std::pair<DeviceType, int64_t>> validate_device_info(const ArrayData& 
data) {
+  DeviceType device_type = DeviceType::UNKNOWN;
+  int64_t device_id = -1;
+
+  for (const auto& buf : data.buffers) {
+    if (!buf) {
+      // some buffers might be null
+      // for example, the null bitmap is optional if there's no nulls
+      continue;
+    }
+
+    if (device_type == DeviceType::UNKNOWN) {
+      device_type = buf->device_type();
+      device_id = buf->device()->device_id();
+      continue;
+    }
+
+    if (buf->device_type() != device_type) {
+      return Status::Invalid(
+          "exporting device array with buffers on more than one device.");

Review Comment:
   gah, too much of my Go conditioning :stuck_out_tongue: lol Since you don't 
typically capitalize error messages for Go. I'll fix it.



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