MCPcopy Create free account
hub / github.com/apache/arrow / ViewOrCastChunkedArray

Function ViewOrCastChunkedArray

cpp/src/parquet/arrow/reader_internal.cc:289–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287}
288
289Result<std::shared_ptr<ChunkedArray>> ViewOrCastChunkedArray(
290 const std::shared_ptr<ChunkedArray>& array, MemoryPool* pool,
291 const std::shared_ptr<DataType>& logical_value_type) {
292 auto view_result = array->View(logical_value_type);
293 if (view_result.ok()) {
294 return view_result.ValueOrDie();
295 } else {
296 ::arrow::compute::ExecContext exec_context(pool);
297 ARROW_ASSIGN_OR_RAISE(
298 auto casted_datum,
299 ::arrow::compute::Cast(Datum(array), logical_value_type,
300 ::arrow::compute::CastOptions(), &exec_context));
301 return casted_datum.chunked_array();
302 }
303}
304
305} // namespace
306

Callers 1

TransferDictionaryFunction · 0.85

Calls 4

ValueOrDieMethod · 0.80
chunked_arrayMethod · 0.80
ViewMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected