khwilson commented on code in PR #44184:
URL: https://github.com/apache/arrow/pull/44184#discussion_r1794464330


##########
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:
   Simplified to just call the common `WidenDecimalToMaxPrecision` function 
which is just the identity on non-Decimal types



-- 
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]

Reply via email to