Skip to content

Commit 59c98c2

Browse files
committed
Update R cookbooks so they pass
1 parent ea6dae9 commit 59c98c2

File tree

2 files changed

+1
-42
lines changed

2 files changed

+1
-42
lines changed

r/content/specify_data_types_and_schemas.Rmd

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -120,45 +120,6 @@ test_that("cast_table works as expected", {
120120
})
121121
```
122122

123-
### Discussion {#no-compat-type}
124-
125-
There are some Arrow data types which do not have any R equivalent. Attempting
126-
to cast to these data types or using a schema which contains them will result in
127-
an error.
128-
129-
```{r, float_16_conversion, error=TRUE, eval=FALSE}
130-
# Set up a tibble to use in this example
131-
oscars <- tibble::tibble(
132-
actor = c("Katharine Hepburn", "Meryl Streep", "Jack Nicholson"),
133-
num_awards = c(4, 3, 3)
134-
)
135-
136-
# Convert tibble to an Arrow table
137-
oscars_arrow <- arrow_table(oscars)
138-
139-
# Set up schema with "num_awards" as float16 which doesn't have an R equivalent
140-
oscars_schema_invalid <- schema(actor = string(), num_awards = float16())
141-
142-
# The default mapping from numeric column "num_awards" is to a double
143-
oscars_arrow$cast(target_schema = oscars_schema_invalid)
144-
```
145-
146-
```{r}
147-
## Error: NotImplemented: Unsupported cast from double to halffloat using function cast_half_float
148-
```
149-
150-
```{r, test_float_16_conversion, opts.label = "test"}
151-
test_that("float_16_conversion works as expected", {
152-
153-
oscars_schema_invalid <- schema(actor = string(), num_awards = float16())
154-
155-
expect_error(
156-
oscars_arrow$cast(target_schema = oscars_schema_invalid),
157-
"NotImplemented: Unsupported cast from double to halffloat using function cast_half_float"
158-
)
159-
})
160-
```
161-
162123
## Specify data types when creating an Arrow table from an R object
163124

164125
You want to manually specify Arrow data types when converting an object from a

r/content/tables.Rmd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,7 @@ test_that("dplyr_func_warning", {
191191
arrow_table(starwars) %>%
192192
mutate(name_split = str_split_fixed(name, " ", 2)) %>%
193193
collect(),
194-
'Expression str_split_fixed(name, " ", 2) not supported in Arrow; pulling data into R',
195-
fixed = TRUE
196-
)
194+
'In str_split_fixed\\(name, " ", 2\\):.*Expression not supported in Arrow.*Pulling data into R')
197195
198196
})
199197
```

0 commit comments

Comments
 (0)