mapleFU commented on code in PR #44184:
URL: https://github.com/apache/arrow/pull/44184#discussion_r1793212262
##########
cpp/src/arrow/compute/kernels/codegen_internal.cc:
##########
@@ -76,6 +76,26 @@ Result<TypeHolder> ListValuesType(KernelContext* ctx,
return value_type;
}
+Result<TypeHolder> MaxPrecisionDecimalType(KernelContext*,
+ const std::vector<TypeHolder>&
args) {
+ std::shared_ptr<DataType> out_type_;
+ auto type_id = args[0].type->id();
+ if (type_id == Type::DECIMAL128 || type_id == Type::DECIMAL256) {
+ auto base_type_ = checked_cast<const DecimalType*>(args[0].type);
+ if (type_id == Type::DECIMAL128) {
+ ARROW_ASSIGN_OR_RAISE(out_type_,
Decimal128Type::Make(Decimal128Type::kMaxPrecision,
+
base_type_->scale()));
+ } else {
+ ARROW_ASSIGN_OR_RAISE(out_type_,
Decimal256Type::Make(Decimal256Type::kMaxPrecision,
+
base_type_->scale()));
+ }
+ } else {
+ return Status::TypeError(
+ "A call to MaxPrecisionDecimalType was made with a non-DecimalType");
Review Comment:
would you mind point out the type here?
##########
cpp/src/arrow/compute/kernels/codegen_internal.h:
##########
@@ -55,6 +55,7 @@ using internal::BinaryBitBlockCounter;
using internal::BitBlockCount;
using internal::BitmapReader;
using internal::checked_cast;
+using internal::checked_pointer_cast;
Review Comment:
why in header?
##########
cpp/src/arrow/compute/kernels/codegen_internal.h:
##########
@@ -1380,6 +1383,8 @@ Status CastBinaryDecimalArgs(DecimalPromotion promotion,
std::vector<TypeHolder>
ARROW_EXPORT
Status CastDecimalArgs(TypeHolder* begin, size_t count);
+Result<std::shared_ptr<DataType>>
WidenDecimalToMaxPrecision(std::shared_ptr<DataType> type);
Review Comment:
Should this being exported?
--
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]