| 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_; |
nothing calls this directly
no test coverage detected