jonkeane commented on code in PR #49343:
URL: https://github.com/apache/arrow/pull/49343#discussion_r2847236707
##########
r/tests/testthat/test-dataset-write.R:
##########
@@ -1015,3 +1015,26 @@ 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)
+
+ unordered_dir <- make_temp_dir()
+ write_dataset(df, unordered_dir)
+
+ ordered_dir <- make_temp_dir()
+ write_dataset(df, ordered_dir, preserve_order = TRUE)
+
+ unordered_ds <- open_dataset(unordered_dir) |> collect()
+ ordered_ds <- open_dataset(ordered_dir) |> collect()
+
+ # Unordered is set equal, but not necessarily equal.
+ expect_setequal(unordered_ds$x, df$x)
+ # expect_false(all(unordered_ds$x == df$x)) can fail on certain
+ # platforms, so is not tested.
Review Comment:
Oh, interesting — which platforms? I can also imagine that there are certain
circumstances where it will be happen to wind up in the right order by chance
too. It would be good to know where this failed though.
--
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]