| 146 | using dest_offset_type = typename DestType::offset_type; |
| 147 | |
| 148 | static Status Exec(KernelContext* ctx, const ExecSpan& batch, ExecResult* out) { |
| 149 | const CastOptions& options = CastState::Get(ctx); |
| 150 | |
| 151 | auto child_type = checked_cast<const DestType&>(*out->type()).value_type(); |
| 152 | |
| 153 | const ArraySpan& in_array = batch[0].array; |
| 154 | |
| 155 | ArrayData* out_array = out->array_data().get(); |
| 156 | ARROW_ASSIGN_OR_RAISE(out_array->buffers[0], |
| 157 | GetOrCopyNullBitmapBuffer(in_array, ctx->memory_pool())); |
| 158 | |
| 159 | const auto& in_type = checked_cast<const FixedSizeListType&>(*in_array.type); |
| 160 | const int32_t list_size = in_type.list_size(); |
| 161 | |
| 162 | // Allocate a new offsets buffer |
| 163 | ARROW_ASSIGN_OR_RAISE(out_array->buffers[1], |
| 164 | ctx->Allocate(sizeof(dest_offset_type) * (batch.length + 1))); |
| 165 | auto* offsets = out_array->GetMutableValues<dest_offset_type>(1); |
| 166 | dest_offset_type offset = 0; |
| 167 | for (int64_t i = 0; i <= batch.length; ++i) { |
| 168 | offsets[i] = offset; |
| 169 | offset += list_size; |
| 170 | } |
| 171 | |
| 172 | // Handle values |
| 173 | std::shared_ptr<ArrayData> values = in_array.child_data[0].ToArrayData(); |
| 174 | if (in_array.offset > 0) { |
| 175 | values = values->Slice(in_array.offset * list_size, in_array.length * list_size); |
| 176 | } |
| 177 | ARROW_ASSIGN_OR_RAISE(Datum cast_values, |
| 178 | Cast(values, child_type, options, ctx->exec_context())); |
| 179 | DCHECK(cast_values.is_array()); |
| 180 | out_array->child_data.push_back(cast_values.array()); |
| 181 | |
| 182 | return Status::OK(); |
| 183 | } |
| 184 | }; |
| 185 | |
| 186 | template <typename SrcType> |
nothing calls this directly
no test coverage detected