Github user shivaram commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17483#discussion_r109258117
  
    --- Diff: R/pkg/inst/tests/testthat/test_sparkSQL.R ---
    @@ -2977,6 +2981,51 @@ test_that("Collect on DataFrame when NAs exists at 
the top of a timestamp column
       expect_equal(class(ldf3$col3), c("POSIXct", "POSIXt"))
     })
     
    +test_that("catalog APIs, currentDatabase, setCurrentDatabase, 
listDatabases", {
    +  expect_equal(currentDatabase(), "default")
    +  expect_error(setCurrentDatabase("default"), NA)
    +  expect_error(setCurrentDatabase("foo"),
    +               "Error in setCurrentDatabase : analysis error - Database 
'foo' does not exist")
    +  dbs <- collect(listDatabases())
    +  expect_equal(names(dbs), c("name", "description", "locationUri"))
    +  expect_equal(dbs[[1]], "default")
    +})
    +
    +test_that("catalog APIs, listTables, listColumns, listFunctions", {
    +  tb <- listTables()
    +  count <- count(suppressWarnings(tables()))
    +  expect_equal(nrow(tb), count)
    +  expect_equal(colnames(tb), c("name", "database", "description", 
"tableType", "isTemporary"))
    +
    +  createOrReplaceTempView(as.DataFrame(cars), "cars")
    +
    +  tb <- listTables()
    +  expect_equal(nrow(tb), count + 1)
    +  tbs <- collect(tb)
    +  expect_true(nrow(tbs[tbs$name == "cars", ]) > 0)
    +  expect_error(listTables("bar"),
    +               "Error in listTables : no such database - Database 'bar' 
not found")
    +
    +  c <- listColumns("cars")
    +  expect_equal(nrow(c), 2)
    +  expect_equal(colnames(c),
    +               c("name", "description", "dataType", "nullable", 
"isPartition", "isBucket"))
    +  expect_equal(collect(c)[[1]][[1]], "speed")
    +  expect_error(listColumns("foo", "default"),
    +       "Error in listColumns : analysis error - Table 'foo' does not exist 
in database 'default'")
    +
    +  dropTempView("cars")
    +
    +  f <- listFunctions()
    +  expect_true(nrow(f) >= 200) # 250
    +  expect_equal(colnames(f),
    +               c("name", "database", "description", "className", 
"isTemporary"))
    +  expect_equal(take(orderBy(f, "className"), 1)$className,
    +               "org.apache.spark.sql.catalyst.expressions.Abs")
    +  expect_error(listFunctions("foo_db"),
    +               "Error in listFunctions : analysis error - Database 
'foo_db' does not exist")
    +})
    --- End diff --
    
    We dont have tests for `recoverPartitions` `refreshByPath` and 
`refreshTable` ? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to