Skip to content

Commit 678e1ac

Browse files
huaxingaoHyukjinKwon
authored andcommitted
[SPARK-24207][R] follow-up PR for SPARK-24207 to fix code style problems
## What changes were proposed in this pull request? follow-up PR for SPARK-24207 to fix code style problems Closes #23256 from huaxingao/spark-24207-cnt. Authored-by: Huaxin Gao <huaxing@us.ibm.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
1 parent 2ea9792 commit 678e1ac

File tree

6 files changed

+28
-30
lines changed

6 files changed

+28
-30
lines changed

R/pkg/R/mllib_fpm.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,10 @@ setMethod("write.ml", signature(object = "FPGrowthModel", path = "character"),
190190
#' @examples
191191
#' \dontrun{
192192
#' df <- createDataFrame(list(list(list(list(1L, 2L), list(3L))),
193-
#' list(list(list(1L), list(3L, 2L), list(1L, 2L))),
194-
#' list(list(list(1L, 2L), list(5L))),
195-
#' list(list(list(6L)))), schema = c("sequence"))
193+
#' list(list(list(1L), list(3L, 2L), list(1L, 2L))),
194+
#' list(list(list(1L, 2L), list(5L))),
195+
#' list(list(list(6L)))),
196+
#' schema = c("sequence"))
196197
#' frequency <- spark.findFrequentSequentialPatterns(df, minSupport = 0.5, maxPatternLength = 5L,
197198
#' maxLocalProjDBSize = 32000000L)
198199
#' showDF(frequency)

R/pkg/tests/fulltests/test_mllib_fpm.R

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,20 @@ test_that("spark.fpGrowth", {
8484
})
8585

8686
test_that("spark.prefixSpan", {
87-
df <- createDataFrame(list(list(list(list(1L, 2L), list(3L))),
88-
list(list(list(1L), list(3L, 2L), list(1L, 2L))),
89-
list(list(list(1L, 2L), list(5L))),
90-
list(list(list(6L)))), schema = c("sequence"))
91-
result1 <- spark.findFrequentSequentialPatterns(df, minSupport = 0.5, maxPatternLength = 5L,
92-
maxLocalProjDBSize = 32000000L)
93-
94-
expected_result <- createDataFrame(list(list(list(list(1L)), 3L),
95-
list(list(list(3L)), 2L),
96-
list(list(list(2L)), 3L),
97-
list(list(list(1L, 2L)), 3L),
98-
list(list(list(1L), list(3L)), 2L)),
99-
schema = c("sequence", "freq"))
100-
})
87+
df <- createDataFrame(list(list(list(list(1L, 2L), list(3L))),
88+
list(list(list(1L), list(3L, 2L), list(1L, 2L))),
89+
list(list(list(1L, 2L), list(5L))),
90+
list(list(list(6L)))),
91+
schema = c("sequence"))
92+
result <- spark.findFrequentSequentialPatterns(df, minSupport = 0.5, maxPatternLength = 5L,
93+
maxLocalProjDBSize = 32000000L)
94+
95+
expected_result <- createDataFrame(list(list(list(list(1L)), 3L), list(list(list(3L)), 2L),
96+
list(list(list(2L)), 3L), list(list(list(1L, 2L)), 3L),
97+
list(list(list(1L), list(3L)), 2L)),
98+
schema = c("sequence", "freq"))
99+
100+
expect_equivalent(expected_result, result)
101+
})
101102

102103
sparkR.session.stop()

R/pkg/vignettes/sparkr-vignettes.Rmd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,9 +1019,10 @@ head(predict(fpm, df))
10191019

10201020
```{r}
10211021
df <- createDataFrame(list(list(list(list(1L, 2L), list(3L))),
1022-
list(list(list(1L), list(3L, 2L), list(1L, 2L))),
1023-
list(list(list(1L, 2L), list(5L))),
1024-
list(list(list(6L)))), schema = c("sequence"))
1022+
list(list(list(1L), list(3L, 2L), list(1L, 2L))),
1023+
list(list(list(1L, 2L), list(5L))),
1024+
list(list(list(6L)))),
1025+
schema = c("sequence"))
10251026
head(spark.findFrequentSequentialPatterns(df, minSupport = 0.5, maxPatternLength = 5L))
10261027
```
10271028

examples/src/main/r/ml/prefixSpan.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ sparkR.session(appName = "SparkR-ML-prefixSpan-example")
2828
# Load training data
2929

3030
df <- createDataFrame(list(list(list(list(1L, 2L), list(3L))),
31-
list(list(list(1L), list(3L, 2L), list(1L, 2L))),
32-
list(list(list(1L, 2L), list(5L))),
33-
list(list(list(6L)))), schema = c("sequence"))
31+
list(list(list(1L), list(3L, 2L), list(1L, 2L))),
32+
list(list(list(1L, 2L), list(5L))),
33+
list(list(list(6L)))),
34+
schema = c("sequence"))
3435

3536
# Finding frequent sequential patterns
3637
frequency <- spark.findFrequentSequentialPatterns(df, minSupport = 0.5, maxPatternLength = 5L,
@@ -39,4 +40,4 @@ showDF(frequency)
3940

4041
# $example off$
4142

42-
sparkR.session.stop()
43+
sparkR.session.stop()

examples/src/main/scala/org/apache/spark/examples/ml/FPGrowthExample.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
package org.apache.spark.examples.ml
1919

20-
// scalastyle:off println
21-
2220
// $example on$
2321
import org.apache.spark.ml.fpm.FPGrowth
2422
// $example off$
@@ -64,4 +62,3 @@ object FPGrowthExample {
6462
spark.stop()
6563
}
6664
}
67-
// scalastyle:on println

examples/src/main/scala/org/apache/spark/examples/ml/PrefixSpanExample.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
package org.apache.spark.examples.ml
1919

20-
// scalastyle:off println
21-
2220
// $example on$
2321
import org.apache.spark.ml.fpm.PrefixSpan
2422
// $example off$
@@ -59,4 +57,3 @@ object PrefixSpanExample {
5957
spark.stop()
6058
}
6159
}
62-
// scalastyle:on println

0 commit comments

Comments
 (0)