cyb70289 commented on a change in pull request #9948:
URL: https://github.com/apache/arrow/pull/9948#discussion_r610285862
##########
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:
If `current_precision` is int32:min, looks `current_scale` must also be
int32::min? So without std::max, guess it should also work.
But I think keep std::max there is better in case we change the behaviour.
**EDIT:** I didn't realize `scale` can be negative.
--
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]