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

Method Decode

cpp/src/arrow/csv/converter.cc:284–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282 type_scale_(decimal_type_.scale()) {}
283
284 Status Decode(const uint8_t* data, uint32_t size, bool quoted, value_type* out) {
285 TrimWhiteSpace(&data, &size);
286 Decimal128 decimal;
287 int32_t precision, scale;
288 std::string_view view(reinterpret_cast<const char*>(data), size);
289 RETURN_NOT_OK(Decimal128::FromString(view, &decimal, &precision, &scale));
290 if (precision > type_precision_) {
291 return Status::Invalid("Error converting '", view, "' to ", type_->ToString(),
292 ": precision not supported by type.");
293 }
294 if (scale != type_scale_) {
295 ARROW_ASSIGN_OR_RAISE(*out, decimal.Rescale(scale, type_scale_));
296 } else {
297 *out = std::move(decimal);
298 }
299 return Status::OK();
300 }
301
302 protected:
303 const DecimalType& decimal_type_;

Callers

nothing calls this directly

Calls 7

TrimWhiteSpaceFunction · 0.85
FromStringFunction · 0.85
RescaleMethod · 0.80
InvalidFunction · 0.50
ARROW_ASSIGN_OR_RAISEFunction · 0.50
OKFunction · 0.50
ToStringMethod · 0.45

Tested by

no test coverage detected