Skip to content

Commit

Permalink
Fix tests after update of dbplyr
Browse files Browse the repository at this point in the history
- remote_name is now a character not an "ident"
- others
  • Loading branch information
gregleleu committed Nov 8, 2023
1 parent 97258a3 commit 2db36cf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions R/tests/testthat/test-data-interface.R
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ test_that("spark_read_geoparquet() works as expected", {
)

## Right registered name
expect_equal(geoparquet_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name))
expect_equal(geoparquet_sdf %>% dbplyr::remote_name(), sdf_name)

## Right schema
expect_equivalent(
Expand Down Expand Up @@ -442,7 +442,7 @@ test_that("spark_read_geoparquet() throws an error with plain parquet files", {

expect_error(
spark_read_geoparquet(sc, geoparquet("plain.parquet")),
regexp = "GeoParquet file does not contain valid geo"
regexp = "not contain valid geo"
)

})
Expand All @@ -463,7 +463,7 @@ test_that("spark_read_geojson() works as expected", {
)

## Right registered name
expect_equal(geojson_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name))
expect_equal(geojson_sdf %>% dbplyr::remote_name(), sdf_name)

})

Expand All @@ -478,7 +478,7 @@ test_that("spark_read_geojson() works as expected, no feat", {
)

## Right registered name
expect_equal(geojson_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name))
expect_equal(geojson_sdf %>% dbplyr::remote_name(), sdf_name)

sc %>% DBI::dbExecute(paste0("DROP TABLE ", sdf_name))

Expand All @@ -494,7 +494,7 @@ test_that("spark_read_geojson() works as expected, null values", {
)

## Right registered name
expect_equal(geojson_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name))
expect_equal(geojson_sdf %>% dbplyr::remote_name(), sdf_name)

sc %>% DBI::dbExecute(paste0("DROP TABLE ", sdf_name))

Expand Down Expand Up @@ -522,7 +522,7 @@ test_that("spark_read_geojson() works as expected, with id", {
)

## Right registered name
expect_equal(geojson_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name))
expect_equal(geojson_sdf %>% dbplyr::remote_name(), sdf_name)

sc %>% DBI::dbExecute(paste0("DROP TABLE ", sdf_name))

Expand All @@ -541,7 +541,7 @@ test_that("spark_read_geojson() works as expected, invalid geom", {
)

## Right registered name
expect_equal(geojson_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name))
expect_equal(geojson_sdf %>% dbplyr::remote_name(), sdf_name)


# Remove invalid
Expand All @@ -553,7 +553,7 @@ test_that("spark_read_geojson() works as expected, invalid geom", {
)

## Right registered name
expect_equal(geojson_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name))
expect_equal(geojson_sdf %>% dbplyr::remote_name(), sdf_name)

sc %>% DBI::dbExecute(paste0("DROP TABLE ", sdf_name))

Expand Down Expand Up @@ -676,13 +676,13 @@ test_that("spark_write_geojson() works as expected", {

## order of columns changes !
expect_equal(
names(geojson_sdf) %>% sort(),
names(geojson_2_sdf) %>% sort()
colnames(geojson_sdf) %>% sort(),
colnames(geojson_2_sdf) %>% sort()
)
expect_equal(
geojson_sdf %>% mutate(geometry = geometry %>% st_astext()) %>% collect(),
geojson_2_sdf %>% mutate(geometry = geometry %>% st_astext()) %>% collect() %>%
select(names(geojson_sdf))
select(colnames(geojson_sdf))
)


Expand Down
6 changes: 3 additions & 3 deletions R/tests/testthat/test-sdf-interface.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test_that("sdf_register() works as expected for Spatial RDDs", {

)
)
expect_equal(pt_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name))
expect_equal(pt_sdf %>% dbplyr::remote_name(), sdf_name)

pt_sdf %>% collect()
succeed()
Expand Down Expand Up @@ -68,7 +68,7 @@ test_that("sdf_register() works as expected for Spatial RDDs with fieldNames", {
)
)

expect_equal(polygon_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name))
expect_equal(polygon_sdf %>% dbplyr::remote_name(), sdf_name)

polygon_sdf %>% collect()
succeed()
Expand All @@ -91,7 +91,7 @@ test_that("as.spark.dataframe() works as expected for Spatial RDDs with non-spat
attr_3 = list(name = "attr_3", type = "StringType")
)
)
expect_equal(pt_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name))
expect_equal(pt_sdf %>% dbplyr::remote_name(), sdf_name)

pt_sdf %>% collect()
succeed()
Expand Down

0 comments on commit 2db36cf

Please sign in to comment.