bkietz commented on code in PR #43957:
URL: https://github.com/apache/arrow/pull/43957#discussion_r1754671465


##########
cpp/src/arrow/array/builder_dict.h:
##########
@@ -298,20 +298,11 @@ class DictionaryBuilderBase : public ArrayBuilder {
     return Append(std::string_view(value, length));
   }
 
-  /// \brief Append a decimal (only for Decimal128Type)
-  template <typename T1 = T>
-  enable_if_decimal128<T1, Status> Append(const Decimal128& value) {
-    uint8_t data[16];
-    value.ToBytes(data);
-    return Append(data, 16);
-  }
-
-  /// \brief Append a decimal (only for Decimal128Type)
-  template <typename T1 = T>
-  enable_if_decimal256<T1, Status> Append(const Decimal256& value) {
-    uint8_t data[32];
-    value.ToBytes(data);
-    return Append(data, 32);
+  /// \brief Append a decimal (only for Decimal32/64/128/256 Type)
+  template <typename T1 = T, typename CType = typename TypeTraits<T1>::CType>
+  enable_if_decimal<T1, Status> Append(const CType& value) {
+    auto bytes = value.ToBytes();
+    return Append(bytes.data(), bytes.size());

Review Comment:
   
[argh](https://ci.appveyor.com/project/ApacheSoftwareFoundation/arrow/builds/50577346#L1534)
   ```suggestion
       return Append(bytes.data(), static_cast<int64_t>(bytes.size()));
   ```



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