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


##########
cpp/src/arrow/pretty_print.cc:
##########
@@ -413,18 +414,36 @@ Status ArrayPrinter::WriteValidityBitmap(const Array& 
array) {
   }
 }
 
+Result<std::shared_ptr<Array>> CopyStartEndToCPU(const Array& arr, int window) 
{
+  std::shared_ptr<Array> arr_sliced;
+  if (arr.length() > (2 * window + 1)) {
+    ARROW_ASSIGN_OR_RAISE(auto arr_start,
+                          arr.Slice(0, window + 
1)->CopyTo(default_cpu_memory_manager()));
+    ARROW_ASSIGN_OR_RAISE(
+        auto arr_end,
+        arr.Slice(arr.length() - window - 
1)->CopyTo(default_cpu_memory_manager()));
+    ARROW_ASSIGN_OR_RAISE(arr_sliced, Concatenate({arr_start, arr_end}));
+  } else {
+    ARROW_ASSIGN_OR_RAISE(arr_sliced, 
arr.CopyTo(default_cpu_memory_manager()));

Review Comment:
   Oh, you're referring to slicing the *array* without copying the entirety of 
the buffers. Yea, that's a trickier proposition. The functions exist in libcudf 
already to do this, but we don't link against libcudf in libarrow_cuda (nor do 
I think we should), but in theory we *could* write the necessary code or at 
least figure it out by looking at how libcudf does it. For now, I think that 
the naive approach is likely fine until someone actively states they have an 
issue



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