yitao-li commented on a change in pull request #521: URL: https://github.com/apache/incubator-sedona/pull/521#discussion_r633681332
########## File path: R/sparklyr.sedona/tests/testthat/test-sdf-interface.R ########## @@ -0,0 +1,43 @@ +context("sdf interface") + +sc <- testthat_spark_connection() + +pt_rdd <- sedona_read_dsv_to_typed_rdd( + sc, + location = test_data("arealm-small.csv"), + delimiter = ",", + type = "point", + first_spatial_col_index = 1, + has_non_spatial_attrs = TRUE +) + +test_that("sdf_register() works as expected for Spatial RDDs", { + sdf_name <- random_string("spatial_sdf") + pt_sdf <- sdf_register(pt_rdd, name = sdf_name) + + expect_equivalent( + pt_sdf %>% sdf_schema(), + list(geometry = list(name = "geometry", type = "GeometryUDT")) + ) + expect_equal(pt_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name)) + + pt_sdf %>% collect() + succeed() +}) + +# TODO: +# test_that("as.spark.dataframe() works as expected for Spatial RDDs with non-spatial attributes", { +# sdf_name <- random_string("spatial_sdf") +# pt_sdf <- as.spark.dataframe( +# pt_rdd, non_spatial_cols = paste0("attr_", seq(3)), name = sdf_name +# ) +# +# expect_equivalent( +# pt_sdf %>% sdf_schema(), +# list(geometry = list(name = "geometry", type = "GeometryUDT")) +# ) +# expect_equal(pt_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name)) +# +# pt_sdf %>% collect() +# succeed() +# }) Review comment: @jiayuasu The test case that is commented out here is not working yet, but it's almost working. I tihnk it will be fixed as soon as we address a null-pointer issue with `Adapter.toDf()` (please see https://github.com/apache/incubator-sedona/pull/525 and let me know what you think). -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org