Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/21294#discussion_r187380230
--- Diff: R/pkg/tests/fulltests/test_sparkSQL.R ---
@@ -1497,12 +1496,18 @@ test_that("column functions", {
result <- collect(select(df, element_at(df[[1]], 1L)))[[1]]
expect_equal(result, c(1, 6))
+ # Test array_sort() and sort_array()
+ df <- createDataFrame(list(list(list(2L, 1L, 3L, NULL)), list(list(NULL,
6L, 5L, NULL, 4L))))
+
+ result <- collect(select(df, array_sort(df[[1]])))[[1]]
+ expect_equal(result, list(list(1L, 2L, 3L, NULL), list(4L, 5L, 6L, NULL,
NULL)))
+
result <- collect(select(df, sort_array(df[[1]], FALSE)))[[1]]
- expect_equal(result, list(list(3L, 2L, 1L), list(6L, 5L, 4L)))
+ expect_equal(result, list(list(3L, 2L, 1L, NULL), list(6L, 5L, 4L, NULL,
NULL)))
result <- collect(select(df, sort_array(df[[1]])))[[1]]
- expect_equal(result, list(list(1L, 2L, 3L), list(4L, 5L, 6L)))
+ expect_equal(result, list(list(NULL, 1L, 2L, 3L), list(NULL, NULL, 4L,
5L, 6L)))
- # Test flattern
+ # Test flatten
--- End diff --
I would leave this out to prevent a conflict. It's being fixed in #21255.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]