-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more direct tests of dplyr-eval; update remaining expectations
- Loading branch information
1 parent
36bf23a
commit 0cd2ff3
Showing
8 changed files
with
182 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# try_arrow_dplyr/abandon_ship adds the right message about collect() | ||
|
||
Code | ||
tester(ds, i) | ||
Condition | ||
Error in `validation_error()`: | ||
! arg is 0 | ||
|
||
--- | ||
|
||
Code | ||
tester(ds, i) | ||
Condition | ||
Error in `arrow_not_supported()`: | ||
! arg == 1 not supported in Arrow | ||
> Call collect() first to pull data into R. | ||
|
||
--- | ||
|
||
Code | ||
tester(ds, i) | ||
Condition | ||
Error in `arrow_not_supported()`: | ||
! arg greater than 0 not supported in Arrow | ||
> Try setting arg to -1 | ||
> Or, call collect() first to pull data into R. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# transmute() defuses dots arguments (ARROW-13262) | ||
|
||
Code | ||
tbl %>% Table$create() %>% transmute(a = stringr::str_c(padded_strings, | ||
padded_strings), b = stringr::str_squish(a)) %>% collect() | ||
Condition | ||
Warning: | ||
In stringr::str_squish(a): | ||
i Expression not supported in Arrow | ||
> Pulling data into R | ||
Output | ||
# A tibble: 10 x 2 | ||
a b | ||
<chr> <chr> | ||
1 " a a " a a | ||
2 " b b " b b | ||
3 " c c " c c | ||
4 " d d " d d | ||
5 " e e " e e | ||
6 " f f " f f | ||
7 " g g " g g | ||
8 " h h " h h | ||
9 " i i " i i | ||
10 " j j " j j | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# Scalars in expressions match the type of the field, if possible | ||
|
||
Expression int == "5" not supported in Arrow; pulling data into R | ||
In int == "5": | ||
i Expression not supported in Arrow | ||
> Pulling data into R | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
test_that("various paths in arrow_eval", { | ||
expect_arrow_eval_error( | ||
assert_is(1, "character"), | ||
class = "validation_error" | ||
) | ||
expect_arrow_eval_error( | ||
NoTaVaRiAbLe, | ||
class = "validation_error" | ||
) | ||
expect_arrow_eval_error( | ||
match.arg("z", c("a", "b")), | ||
class = "validation_error" | ||
) | ||
expect_arrow_eval_error( | ||
stop("something something NotImplementedError"), | ||
class = "arrow_not_supported" | ||
) | ||
}) | ||
|
||
test_that("try_arrow_dplyr/abandon_ship adds the right message about collect()", { | ||
tester <- function(.data, arg) { | ||
call <- match.call() | ||
try_arrow_dplyr({ | ||
if (arg == 0) { | ||
# This one just stops and doesn't recommend calling collect() | ||
validation_error("arg is 0") | ||
} else if (arg == 1) { | ||
# This one recommends calling collect() | ||
arrow_not_supported("arg == 1") | ||
} else { | ||
# Because this one has an alternative suggested, it adds "Or, collect()" | ||
arrow_not_supported( | ||
"arg greater than 0", | ||
body = c(">" = "Try setting arg to -1") | ||
) | ||
} | ||
}) | ||
} | ||
|
||
ds <- InMemoryDataset$create(arrow_table(x = 1)) | ||
for (i in 0:2) { | ||
expect_snapshot(tester(ds, i), error = TRUE) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters