jorisvandenbossche commented on a change in pull request #9948:
URL: https://github.com/apache/arrow/pull/9948#discussion_r609637601



##########
File path: cpp/src/arrow/python/decimal.cc
##########
@@ -214,12 +214,14 @@ DecimalMetadata::DecimalMetadata(int32_t precision, 
int32_t scale)
     : precision_(precision), scale_(scale) {}
 
 Status DecimalMetadata::Update(int32_t suggested_precision, int32_t 
suggested_scale) {
-  const int32_t current_precision = precision_;
-  precision_ = std::max(current_precision, suggested_precision);
-
   const int32_t current_scale = scale_;
   scale_ = std::max(current_scale, suggested_scale);
 
+  const int32_t current_precision = precision_;
+  auto n_integral = std::max(std::max(current_precision, 0) - 
std::max(current_scale, 0),

Review comment:
       Those additional `max(current, 0)` checks make it a bit ugly, but this 
is required (I think) because on the first call, the current_precision or 
current_scale can still be the int32 min value (-2147483648)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to