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

Method Visit

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

Source from the content-addressed store, hash-verified

300
301 template <typename T>
302 Status Visit(const T&) {
303 if constexpr (is_numeric(T::type_id)) {
304 using In = typename T::c_type;
305 auto in_values = ArraySpan(in_data).GetSpan<In>(1, in_data.length);
306
307 const int64_t base = chunk_idx * num_cols + col_idx;
308
309 if (in_data.null_count == 0) {
310 for (int64_t i = 0; i < in_data.length; ++i) {
311 out_values[base + i * num_cols] = static_cast<Out>(in_values[i]);
312 }
313 } else {
314 for (int64_t i = 0; i < in_data.length; ++i) {
315 if constexpr (T::type_id == Type::HALF_FLOAT && std::is_same_v<Out, uint16_t>) {
316 out_values[base + i * num_cols] =
317 in_data.IsNull(i) ? std::numeric_limits<util::Float16>::quiet_NaN().bits()
318 : static_cast<Out>(in_values[i]);
319 } else {
320 out_values[base + i * num_cols] = in_data.IsNull(i)
321 ? static_cast<Out>(NAN)
322 : static_cast<Out>(in_values[i]);
323 }
324 }
325 }
326 return Status::OK();
327 }
328 Unreachable();
329 }
330};
331
332template <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