| 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 | |
| 266 | template <typename Out> |
nothing calls this directly
no test coverage detected