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

Function ConvertNumber

cpp/src/arrow/json/from_string.cc:217–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215// Convert single signed integer value (also {Date,Time}{32,64} and Timestamp)
216template <typename T>
217enable_if_physical_signed_integer<T, Status> ConvertNumber(const rj::Value& json_obj,
218 const DataType& type,
219 typename T::c_type* out) {
220 if (json_obj.IsInt64()) {
221 int64_t v64 = json_obj.GetInt64();
222 *out = static_cast<typename T::c_type>(v64);
223 if (*out == v64) {
224 return Status::OK();
225 } else {
226 return Status::Invalid("Value ", v64, " out of bounds for ", type);
227 }
228 } else {
229 *out = static_cast<typename T::c_type>(0);
230 return JSONTypeError("signed int", json_obj.GetType());
231 }
232}
233
234// Convert single unsigned integer value
235template <typename T>

Callers

nothing calls this directly

Calls 6

JSONTypeErrorFunction · 0.85
OKFunction · 0.70
InvalidFunction · 0.50
Float16Function · 0.50
GetTypeMethod · 0.45
GetDoubleMethod · 0.45

Tested by

no test coverage detected