From 9944230a7cf0601bc058f634ff327661c7100147 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Thu, 6 Jun 2024 14:04:41 +0200 Subject: [PATCH] GH-41664: PrettyPrint non-cpu data by copying slice to default CPU device --- cpp/src/arrow/pretty_print.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpp/src/arrow/pretty_print.cc b/cpp/src/arrow/pretty_print.cc index e666ec70f9489..d6957e73d9166 100644 --- a/cpp/src/arrow/pretty_print.cc +++ b/cpp/src/arrow/pretty_print.cc @@ -425,6 +425,10 @@ Status PrettyPrint(const Array& arr, int indent, std::ostream* sink) { Status PrettyPrint(const Array& arr, const PrettyPrintOptions& options, std::ostream* sink) { ArrayPrinter printer(options, sink); + if (arr.device_type() != DeviceAllocationType::kCPU) { + auto arr_sliced = arr.CopyTo(default_cpu_memory_manager()); + return printer.Print(arr); + } return printer.Print(arr); }