-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-20159][SPARKR][SQL] Support all catalog API in R #17483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
e4808b6
5ab5834
28195b9
9c768ae
5093891
3c66930
2aea0cb
aff13a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…s(), test for recoverPartitions/refresh*
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -645,9 +645,12 @@ test_that("test tableNames and tables", { | |
| df <- read.json(jsonPath) | ||
| createOrReplaceTempView(df, "table1") | ||
| expect_equal(length(tableNames()), 1) | ||
| expect_equal(length(tableNames("default")), 1) | ||
| tables <- listTables() | ||
| expect_equal(count(tables), 1) | ||
| expect_equal(count(suppressWarnings(tables())), count(tables)) | ||
| expect_equal(count(tables()), count(tables)) | ||
| expect_true("tableName" %in% colnames(tables())) | ||
| expect_true(all(c("tableName", "database", "isTemporary") %in% colnames(tables()))) | ||
|
|
||
| suppressWarnings(registerTempTable(df, "table2")) | ||
| tables <- listTables() | ||
|
|
@@ -2993,7 +2996,7 @@ test_that("catalog APIs, currentDatabase, setCurrentDatabase, listDatabases", { | |
|
|
||
| test_that("catalog APIs, listTables, listColumns, listFunctions", { | ||
| tb <- listTables() | ||
| count <- count(suppressWarnings(tables())) | ||
| count <- count(tables()) | ||
| expect_equal(nrow(tb), count) | ||
| expect_equal(colnames(tb), c("name", "database", "description", "tableType", "isTemporary")) | ||
|
|
||
|
|
@@ -3014,8 +3017,6 @@ test_that("catalog APIs, listTables, listColumns, listFunctions", { | |
| 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), | ||
|
|
@@ -3024,6 +3025,12 @@ test_that("catalog APIs, listTables, listColumns, listFunctions", { | |
| "org.apache.spark.sql.catalyst.expressions.Abs") | ||
| expect_error(listFunctions("foo_db"), | ||
| "Error in listFunctions : analysis error - Database 'foo_db' does not exist") | ||
|
|
||
| expect_error(recoverPartitions("cars"), NA) | ||
| expect_error(refreshTable("cars"), NA) | ||
| expect_error(refreshByPath("/"), NA) | ||
|
|
||
| dropTempView("cars") | ||
| }) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We dont have tests for
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sharp eyes :) I was planning to add tests. I tested these manually, but the steps are more involved and these are only thin wrappers in R I think we should defer to scala tests. |
||
|
|
||
| compare_list <- function(list1, list2) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is
tables()deprecated now ?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, there are some differences of the output (most notability catalog.listTables returns a
Dataset<Table>- but I'm converting that into a DataFrame anyway), and I thought list* would be more consistent with other methods likelistColumn(),listDatabases()If you think it makes sense, we could make
tablesan alias oflistTables- it's going to call slightly different code on the Scala side and there are new columns and one different column name being returned.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.