ianmcook commented on a change in pull request #9745:
URL: https://github.com/apache/arrow/pull/9745#discussion_r598781846



##########
File path: r/tests/testthat/helper-data.R
##########
@@ -134,3 +134,17 @@ example_with_logical_factors <- tibble::tibble(
     "hey buddy"
   )
 )
+
+# the values in each column of this tibble are in ascending order in the C 
locale.
+# there are some ties, but sorting by any two columns will give a 
deterministic order.
+example_data_for_sorting <- tibble::tibble(
+  int = c(-.Machine$integer.max, -101L, -100L, 0L, 0L, 1L, 100L, 1000L, 
.Machine$integer.max, NA_integer_),
+  dbl = c(-Inf, -.Machine$double.xmax, -.Machine$double.xmin, 0, 
.Machine$double.xmin, pi, .Machine$double.xmax, Inf, NaN, NA_real_),
+  # R string collation varies by locale, while libarrow always uses the C 
locale for string collation
+  # (in other words: string values in libarrow are ordered lexicographically 
as bytestrings)
+  # to make R sort functions use the C locale, run Sys.setlocale("LC_COLLATE", 
"C")

Review comment:
       Confirmed it does, and this is mentioned at 
https://testthat.r-lib.org/reference/local_test_context.html#details. I 
improved this comment in 7b64d1ff18b4f587313be212fc0816e55a54a754.




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

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


Reply via email to