pitrou commented on code in PR #45685:
URL: https://github.com/apache/arrow/pull/45685#discussion_r1983035186


##########
cpp/src/parquet/arrow/reader_internal.cc:
##########
@@ -256,6 +256,23 @@ Status ByteArrayStatisticsAsScalars(const Statistics& 
statistics,
   return Status::OK();
 }
 
+Result<std::shared_ptr<ChunkedArray>> ViewOrCastChunkedArray(
+    const std::shared_ptr<ChunkedArray>& array,
+    const std::shared_ptr<DataType>& logical_value_type) {
+  auto view_result = array->View(logical_value_type);
+  if (view_result.ok()) {
+    return view_result.ValueOrDie();
+  } else {
+    ::arrow::ArrayVector casted_chunks;
+    for (const auto& chunk : array->chunks()) {
+      ARROW_ASSIGN_OR_RAISE(auto cast_chunk,
+                            ::arrow::compute::Cast(chunk, logical_value_type));
+      casted_chunks.push_back(cast_chunk.make_array());
+    }

Review Comment:
   If you take a look at `TransferBinary`, it takes a `MemoryPool` argument. So 
you can probably change the `TransferDictionary` signature to also take one 
(and of course update the call site(s)).



-- 
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: github-unsubscr...@arrow.apache.org

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

Reply via email to