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

Method Visit

cpp/src/arrow/tensor.cc:275–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273
274 template <typename T>
275 Status Visit(const T&) {
276 if constexpr (is_numeric(T::type_id)) {
277 using In = typename T::c_type;
278 auto in_values = ArraySpan(in_data).GetSpan<In>(1, in_data.length);
279
280 const int64_t base = chunk_idx * num_cols + col_idx;
281
282 if (in_data.null_count == 0) {
283 for (int64_t i = 0; i < in_data.length; ++i) {
284 out_values[base + i * num_cols] = static_cast<Out>(in_values[i]);
285 }
286 } else {
287 for (int64_t i = 0; i < in_data.length; ++i) {
288 if constexpr (T::type_id == Type::HALF_FLOAT && std::is_same_v<Out, uint16_t>) {
289 out_values[base + i * num_cols] =
290 in_data.IsNull(i) ? std::numeric_limits<util::Float16>::quiet_NaN().bits()
291 : static_cast<Out>(in_values[i]);
292 } else {
293 out_values[base + i * num_cols] = in_data.IsNull(i)
294 ? static_cast<Out>(NAN)
295 : static_cast<Out>(in_values[i]);
296 }
297 }
298 }
299 return Status::OK();
300 }
301 Unreachable();
302 }
303};
304
305template <typename DataType, typename Container>

Callers

nothing calls this directly

Calls 5

is_numericFunction · 0.85
UnreachableFunction · 0.85
ArraySpanClass · 0.70
OKFunction · 0.70
IsNullMethod · 0.45

Tested by

no test coverage detected