| 231 | : precision_(precision), scale_(scale) {} |
| 232 | |
| 233 | Status DecimalMetadata::Update(int32_t suggested_precision, int32_t suggested_scale) { |
| 234 | const int32_t current_scale = scale_; |
| 235 | scale_ = std::max(current_scale, suggested_scale); |
| 236 | |
| 237 | const int32_t current_precision = precision_; |
| 238 | |
| 239 | if (current_precision == std::numeric_limits<int32_t>::min()) { |
| 240 | precision_ = suggested_precision; |
| 241 | } else { |
| 242 | auto num_digits = std::max(current_precision - current_scale, |
| 243 | suggested_precision - suggested_scale); |
| 244 | precision_ = std::max(num_digits + scale_, current_precision); |
| 245 | } |
| 246 | |
| 247 | return Status::OK(); |
| 248 | } |
| 249 | |
| 250 | Status DecimalMetadata::Update(PyObject* object) { |
| 251 | bool is_decimal = PyDecimal_Check(object); |