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

Function CastListOffsets

cpp/src/arrow/compute/kernels/scalar_cast_nested.cc:48–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46// things simpler
47template <typename SrcType, typename DestType>
48Status CastListOffsets(KernelContext* ctx, const ArraySpan& in_array,
49 ArrayData* out_array) {
50 using src_offset_type = typename SrcType::offset_type;
51 using dest_offset_type = typename DestType::offset_type;
52
53 if constexpr (!std::is_same<src_offset_type, dest_offset_type>::value) {
54 ARROW_ASSIGN_OR_RAISE(out_array->buffers[1], ctx->Allocate(sizeof(dest_offset_type) *
55 (in_array.length + 1)));
56 ::arrow::internal::CastInts(in_array.GetValues<src_offset_type>(1),
57 out_array->GetMutableValues<dest_offset_type>(1),
58 in_array.length + 1);
59 }
60
61 return Status::OK();
62}
63
64template <typename SrcType, typename DestType>
65struct CastList {

Callers

nothing calls this directly

Calls 4

CastIntsFunction · 0.85
ARROW_ASSIGN_OR_RAISEFunction · 0.50
OKFunction · 0.50
AllocateMethod · 0.45

Tested by

no test coverage detected