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

Method Update

python/pyarrow/src/arrow/python/decimal.cc:233–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231 : precision_(precision), scale_(scale) {}
232
233Status 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
250Status DecimalMetadata::Update(PyObject* object) {
251 bool is_decimal = PyDecimal_Check(object);

Calls 4

PyDecimal_CheckFunction · 0.85
PyDecimal_ISNANFunction · 0.85
OKFunction · 0.50