marberts commented on code in PR #49343:
URL: https://github.com/apache/arrow/pull/49343#discussion_r2844180340


##########
r/tests/testthat/test-dataset-write.R:
##########
@@ -1015,3 +1015,20 @@ test_that("Dataset write wrappers can write flat files 
using readr::write_csv()
     c("true", "false", "NOVALUE", "true", "false", "true", "false", "NOVALUE", 
"true", "false")
   )
 })
+
+test_that("Row order is preserved when writing large parquet dataset", {
+  skip_if_not_available("parquet")
+  # Make a data frame with a sufficiently large number of rows.
+  df <- data.frame(x = 1:1.1e6)
+  dst_dir1 <- make_temp_dir()
+  write_dataset(df, dst_dir1)
+
+  dst_dir2 <- make_temp_dir()
+  write_dataset(df, dst_dir2, preserve_order = TRUE)
+
+  ds1 <- open_dataset(dst_dir1) |> collect()
+  ds2 <- open_dataset(dst_dir2) |> collect()
+
+  expect_true(any(ds1$x != df$x))
+  expect_true(all(ds2$x == df$x))

Review Comment:
   You're right, your suggestion for naming and test assertions is clearer. 
Thanks!
   
   It turns out the unordered case is platform dependent, as the test is 
failing in one case on windows: 
https://github.com/apache/arrow/actions/runs/22290480076/job/64536892096?pr=49343#step:10:24418.
   
   I updated the test to only test for equality in the ordered case, noting 
that the test for lack of equality for the unordered case can fail. I don't 
think this is a problem because it's still testing the desired behavior when 
`preserve_order = TRUE`.



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