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

Method Visit

cpp/src/arrow/tensor.cc:261–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259
260 template <typename T>
261 Status Visit(const T&) {
262 if constexpr (is_numeric(T::type_id)) {
263 using In = typename T::c_type;
264 auto in_values = ArraySpan(in_data).GetSpan<In>(1, in_data.length);
265
266 if (in_data.null_count == 0) {
267 if constexpr (std::is_same_v<In, Out>) {
268 memcpy(out_values, in_values.data(), in_values.size_bytes());
269 out_values += in_values.size();
270 } else {
271 for (In in_value : in_values) {
272 *out_values++ = static_cast<Out>(in_value);
273 }
274 }
275 } else {
276 for (int64_t i = 0; i < in_data.length; ++i) {
277 if constexpr (T::type_id == Type::HALF_FLOAT && std::is_same_v<Out, uint16_t>) {
278 *out_values++ = in_data.IsNull(i)
279 ? std::numeric_limits<util::Float16>::quiet_NaN().bits()
280 : static_cast<Out>(in_values[i]);
281 } else {
282 *out_values++ = in_data.IsNull(i) ? static_cast<Out>(NAN)
283 : static_cast<Out>(in_values[i]);
284 }
285 }
286 }
287 return Status::OK();
288 }
289 Unreachable();
290 }
291};
292
293template <typename Out>

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected