apache / apache/arrow

[R] slice_sample returns 0 rows

Open
#38,638 5 comments 0 reactions 0 assignees View on GitHub
Component: R Critical Fix Priority: Critical Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

``` r
library(arrow)
#>
#> Attaching package: 'arrow'
#> The following object is masked from 'package:utils':
#>
#> timestamp
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
tf <- tempfile()
dir.create(tf)
write_dataset(group_by(mtcars, cyl), tf)
open_dataset(tf) %>%
slice_sample(n = 3) %>%
collect()
#> # A tibble: 0 × 11
#> # ℹ 11 variables: mpg , disp , hp , drat , wt ,
#> # qsec , vs , am , gear , carb , cyl
```

Created on 2023-11-08 with [reprex v2.0.2](https://reprex.tidyverse.org)

### Component(s)

R

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.