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 2023/01/12 14:45:56 UTC

[GitHub] [arrow] thisisnic commented on a diff in pull request #15211: ARROW-11631: [R] Implement RPrimitiveConverter for Decimal type

thisisnic commented on code in PR #15211:
URL: https://github.com/apache/arrow/pull/15211#discussion_r1068210711


##########
r/tests/testthat/test-Array.R:
##########
@@ -1321,3 +1321,19 @@ test_that("Array to C-interface", {
   delete_arrow_schema(schema_ptr)
   delete_arrow_array(array_ptr)
 })
+
+test_that("direct creation of Decimal Arrays (ARROW-11631)", {
+
+  decimal_array <- Array$create(1, type = decimal128(10, 2))
+  decimal_array2 <- Array$create(1, type = decimal256(10, 2))
+
+  expect_equal(

Review Comment:
   Hmm, interesting...I now get this result:
   
   ```
   > Array$create(c(1:10, NA))$cast(decimal128(10, 2))
   Error: Invalid: Precision is not great enough for the result. It should be at least 12
   /home/nic2/arrow/cpp/src/arrow/compute/exec.cc:828  kernel_->exec(kernel_ctx_, input, out)
   /home/nic2/arrow/cpp/src/arrow/compute/exec.cc:796  ExecuteSingleSpan(input, &output)
   /home/nic2/arrow/cpp/src/arrow/compute/function.cc:276  executor->Execute(input, &listener)
   ```
   
   Looks like a bug given 10 significant digits is more than enough to represent the integers 1 through 10



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