jonkeane commented on a change in pull request #11898:
URL: https://github.com/apache/arrow/pull/11898#discussion_r772423892



##########
File path: r/tests/testthat/test-Array.R
##########
@@ -795,6 +795,26 @@ test_that("Array$create() should have helpful error", {
   expect_error(Array$create(list()), "Requires at least one element to infer")
   expect_error(Array$create(list(lgl, lgl, int)), "Expecting a logical vector")
   expect_error(Array$create(list(char, num, char)), "Expecting a character 
vector")
+
+  # hint at casting if direct fails and casting looks like it might work
+  expect_error(
+    Array$create(as.double(1:10), type = decimal(4, 2)),
+    "You might want to try casting manually"
+  )
+  # until ARROW-15159 is solved casting from integer to decimal requires a
+  # precision of at least 12
+  # precision < 12 => the attempt to cast errors and the original error message
+  # is shown
+  expect_error(
+    Array$create(1:10, type = decimal(11, 2)),
+    "NotImplemented: Extend"
+  )

Review comment:
       Do we want / need this error message test here? I assume the C++ will be 
resolved (since that restriction seems quite odd!), and we test below that we 
still get our "try casting manually" error. 




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