zeroshade commented on code in PR #43957:
URL: https://github.com/apache/arrow/pull/43957#discussion_r1766939055
##########
cpp/src/arrow/util/decimal.cc:
##########
@@ -109,6 +110,11 @@ struct DecimalRealConversion : public
BaseDecimalRealConversion {
return OverflowError(real, precision, scale);
}
+ if constexpr (std::is_base_of_v<BasicDecimal32, DecimalType> &&
+ std::is_same_v<Real, double>) {
+ return DecimalType::FromReal(static_cast<float>(real), precision, scale);
Review Comment:
the example you give would essentially be the same condition (though more
concise) which would always affect double->Decimal32 conversions. That said,
using `FromPositiveRealApprox` is likely better than a blanket drop to float.
I'll give this a try and make sure the tests still pass for it.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]