You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/06/16 00:11:22 UTC

[GitHub] [arrow] kou commented on a diff in pull request #13377: ARROW-14518: [Ruby] Add support for Arrow::Array.new([BigDecimal])

kou commented on code in PR #13377:
URL: https://github.com/apache/arrow/pull/13377#discussion_r898577939


##########
ruby/red-arrow/lib/arrow/array-builder.rb:
##########
@@ -121,15 +126,28 @@ def detect_builder_info(value, builder_info)
             detected: true,
           }
         when BigDecimal
-          if value.to_arrow.is_a?(Decimal128)
-            {
-              builder: Decimal128ArrayBuilder.new,
-            }
-          else
+          builder_info ||= {}
+          if builder_info[:builder]
             {
-              builder: Decimal256ArrayBuilder.new,
+              builder: StringArrayBuilder.new,
               detected: true,
             }
+          else
+            precision = [builder_info[:precision] || 0, value.precision].max
+            scale = [builder_info[:scale] || 0, value.scale].max

Review Comment:
   Could you provide an example case?
   `Arrow::Array.new([BigDecimal("1.1"), BigDecimal("11.11")])`?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org