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

Method Visit

cpp/src/arrow/tensor.cc:234–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232
233 template <typename T>
234 Status Visit(const T&) {
235 if constexpr (is_numeric(T::type_id)) {
236 using In = typename T::c_type;
237 auto in_values = ArraySpan(in_data).GetSpan<In>(1, in_data.length);
238
239 if (in_data.null_count == 0) {
240 if constexpr (std::is_same_v<In, Out>) {
241 memcpy(out_values, in_values.data(), in_values.size_bytes());
242 out_values += in_values.size();
243 } else {
244 for (In in_value : in_values) {
245 *out_values++ = static_cast<Out>(in_value);
246 }
247 }
248 } else {
249 for (int64_t i = 0; i < in_data.length; ++i) {
250 if constexpr (T::type_id == Type::HALF_FLOAT && std::is_same_v<Out, uint16_t>) {
251 *out_values++ = in_data.IsNull(i)
252 ? std::numeric_limits<util::Float16>::quiet_NaN().bits()
253 : static_cast<Out>(in_values[i]);
254 } else {
255 *out_values++ = in_data.IsNull(i) ? static_cast<Out>(NAN)
256 : static_cast<Out>(in_values[i]);
257 }
258 }
259 }
260 return Status::OK();
261 }
262 Unreachable();
263 }
264};
265
266template <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