thisisnic opened a new issue, #39548:
URL: https://github.com/apache/arrow/issues/39548
### Describe the bug, including details regarding any error messages,
version, and platform.
``` r
library(stringr)
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)
data <- tibble::tibble(x = 1)
write_parquet(data, file.path(tf, "2023_01_01.parquet"))
write_parquet(data, file.path(tf, "2023_02_02.parquet"))
write_parquet(data, file.path(tf, "2023_03_03.parquet"))
# works
start_of_query <- open_dataset(tf) |>
mutate(file = add_filename()) |>
mutate(file_date = str_remove(file, ".*/")) |>
mutate(file_date = str_remove(file_date, ".parquet")) |>
mutate(file_date = ymd(file_date)) |>
mutate(year = year(file_date))
# works
start_of_query |>
collect()
#> # A tibble: 3 × 4
#> x file file_date
year
#> <dbl> <chr> <date>
<int>
#> 1 1 /tmp/Rtmpsy0nYY/file2fa7d1c483f2a/2023_03_03.parquet 2023-03-03
2023
#> 2 1 /tmp/Rtmpsy0nYY/file2fa7d1c483f2a/2023_01_01.parquet 2023-01-01
2023
#> 3 1 /tmp/Rtmpsy0nYY/file2fa7d1c483f2a/2023_02_02.parquet 2023-02-02
2023
# doesn't work
start_of_query |>
mutate(month = month(file_date)) |>
collect()
#> Error: Expression month(file_date) not supported in Arrow
#> Call collect() first to pull data into R.
```
The error comes from this bit of code at the top of the binding for
`month()`:
```
call_binding("is.integer", x)
```
which results in this error:
```
Error: Invalid: No match for FieldRef.Name(__filename) in x: double
```
This is most likely pretty much the same as #33464
### Component(s)
R
--
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]