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 2022/07/08 19:47:06 UTC

[GitHub] [arrow] nealrichardson commented on a diff in pull request #13509: ARROW-16904: [C++] min/max not deterministic if Parquet files have multiple row groups

nealrichardson commented on code in PR #13509:
URL: https://github.com/apache/arrow/pull/13509#discussion_r917097216


##########
r/tests/testthat/test-dataset.R:
##########
@@ -618,6 +618,33 @@ test_that("UnionDataset handles InMemoryDatasets", {
   expect_equal(actual, expected)
 })
 
+test_that("scalar aggregates with many batches", {
+  test_data <- data.frame(val = 1:1e7)
+  expected_result_distr <- (
+    sapply(1:100, function(iter_ndx) {
+      test_data                              %>%
+        dplyr::summarise(min_val = min(val)) %>%
+        dplyr::collect()                     %>%
+        dplyr::pull(min_val)
+    }) %>%
+      table()
+  )
+
+  ds_tmpfile <- tempfile("test-aggregate", fileext = ".parquet")
+  arrow::write_parquet(test_data, ds_tmpfile)
+  actual_result_distr <- (
+    sapply(1:100, function(iter_ndx) {
+      arrow::open_dataset(ds_tmpfile)        %>%
+        dplyr::summarise(min_val = min(val)) %>%
+        dplyr::collect()                     %>%
+        dplyr::pull(min_val)
+    }) %>%
+      table()
+  )
+
+  expect_equal(actual_result_distr, expected_result_distr)
+})

Review Comment:
   Here's a simpler test (this fails on master but should pass with your fix)
   
   ```suggestion
   test_that("scalar aggregates with many batches (ARROW-16904)", {
     tf <- tempfile()
     write_parquet(data.frame(x = 1:100), tf, chunk_size = 20)
   
     ds <- open_dataset(tf)
     replicate(100, ds %>% summarize(min(x)) %>% pull())
   
     expect_true(all(replicate(100, ds %>% summarize(min(x)) %>% pull()) == 1))
     expect_true(all(replicate(100, ds %>% summarize(max(x)) %>% pull()) == 100))
   })
   ```



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