@@ -313,7 +313,7 @@ setMethod("checkpoint",
313313# ' @rdname getNumPartitions
314314# ' @aliases getNumPartitions,RDD-method
315315# ' @noRd
316- setMethod ("getNumPartitions ",
316+ setMethod ("getNumPartitionsRDD ",
317317 signature(x = " RDD" ),
318318 function (x ) {
319319 callJMethod(getJRDD(x ), " getNumPartitions" )
@@ -329,7 +329,7 @@ setMethod("numPartitions",
329329 signature(x = " RDD" ),
330330 function (x ) {
331331 .Deprecated(" getNumPartitions" )
332- getNumPartitions (x )
332+ getNumPartitionsRDD (x )
333333 })
334334
335335# ' Collect elements of an RDD
@@ -460,7 +460,7 @@ setMethod("countByValue",
460460 signature(x = " RDD" ),
461461 function (x ) {
462462 ones <- lapply(x , function (item ) { list (item , 1L ) })
463- collectRDD(reduceByKey(ones , `+` , getNumPartitions (x )))
463+ collectRDD(reduceByKey(ones , `+` , getNumPartitionsRDD (x )))
464464 })
465465
466466# ' Apply a function to all elements
@@ -780,7 +780,7 @@ setMethod("takeRDD",
780780 resList <- list ()
781781 index <- - 1
782782 jrdd <- getJRDD(x )
783- numPartitions <- getNumPartitions (x )
783+ numPartitions <- getNumPartitionsRDD (x )
784784 serializedModeRDD <- getSerializedMode(x )
785785
786786 # TODO(shivaram): Collect more than one partition based on size
@@ -846,7 +846,7 @@ setMethod("firstRDD",
846846# ' @noRd
847847setMethod ("distinctRDD ",
848848 signature(x = " RDD" ),
849- function (x , numPartitions = SparkR ::: getNumPartitions (x )) {
849+ function (x , numPartitions = SparkR ::: getNumPartitionsRDD (x )) {
850850 identical.mapped <- lapply(x , function (x ) { list (x , NULL ) })
851851 reduced <- reduceByKey(identical.mapped ,
852852 function (x , y ) { x },
@@ -1053,7 +1053,7 @@ setMethod("coalesce",
10531053 signature(x = " RDD" , numPartitions = " numeric" ),
10541054 function (x , numPartitions , shuffle = FALSE ) {
10551055 numPartitions <- numToInt(numPartitions )
1056- if (shuffle || numPartitions > SparkR ::: getNumPartitions (x )) {
1056+ if (shuffle || numPartitions > SparkR ::: getNumPartitionsRDD (x )) {
10571057 func <- function (partIndex , part ) {
10581058 set.seed(partIndex ) # partIndex as seed
10591059 start <- as.integer(base :: sample(numPartitions , 1 ) - 1 )
@@ -1143,7 +1143,7 @@ setMethod("saveAsTextFile",
11431143# ' @noRd
11441144setMethod ("sortBy ",
11451145 signature(x = " RDD" , func = " function" ),
1146- function (x , func , ascending = TRUE , numPartitions = SparkR ::: getNumPartitions (x )) {
1146+ function (x , func , ascending = TRUE , numPartitions = SparkR ::: getNumPartitionsRDD (x )) {
11471147 values(sortByKey(keyBy(x , func ), ascending , numPartitions ))
11481148 })
11491149
@@ -1175,7 +1175,7 @@ takeOrderedElem <- function(x, num, ascending = TRUE) {
11751175 resList <- list ()
11761176 index <- - 1
11771177 jrdd <- getJRDD(newRdd )
1178- numPartitions <- getNumPartitions (newRdd )
1178+ numPartitions <- getNumPartitionsRDD (newRdd )
11791179 serializedModeRDD <- getSerializedMode(newRdd )
11801180
11811181 while (TRUE ) {
@@ -1407,7 +1407,7 @@ setMethod("setName",
14071407setMethod ("zipWithUniqueId ",
14081408 signature(x = " RDD" ),
14091409 function (x ) {
1410- n <- getNumPartitions (x )
1410+ n <- getNumPartitionsRDD (x )
14111411
14121412 partitionFunc <- function (partIndex , part ) {
14131413 mapply(
@@ -1450,7 +1450,7 @@ setMethod("zipWithUniqueId",
14501450setMethod ("zipWithIndex ",
14511451 signature(x = " RDD" ),
14521452 function (x ) {
1453- n <- getNumPartitions (x )
1453+ n <- getNumPartitionsRDD (x )
14541454 if (n > 1 ) {
14551455 nums <- collectRDD(lapplyPartition(x ,
14561456 function (part ) {
@@ -1566,8 +1566,8 @@ setMethod("unionRDD",
15661566setMethod ("zipRDD ",
15671567 signature(x = " RDD" , other = " RDD" ),
15681568 function (x , other ) {
1569- n1 <- getNumPartitions (x )
1570- n2 <- getNumPartitions (other )
1569+ n1 <- getNumPartitionsRDD (x )
1570+ n2 <- getNumPartitionsRDD (other )
15711571 if (n1 != n2 ) {
15721572 stop(" Can only zip RDDs which have the same number of partitions." )
15731573 }
@@ -1637,7 +1637,7 @@ setMethod("cartesian",
16371637# ' @noRd
16381638setMethod ("subtract ",
16391639 signature(x = " RDD" , other = " RDD" ),
1640- function (x , other , numPartitions = SparkR ::: getNumPartitions (x )) {
1640+ function (x , other , numPartitions = SparkR ::: getNumPartitionsRDD (x )) {
16411641 mapFunction <- function (e ) { list (e , NA ) }
16421642 rdd1 <- map(x , mapFunction )
16431643 rdd2 <- map(other , mapFunction )
@@ -1671,7 +1671,7 @@ setMethod("subtract",
16711671# ' @noRd
16721672setMethod ("intersection ",
16731673 signature(x = " RDD" , other = " RDD" ),
1674- function (x , other , numPartitions = SparkR ::: getNumPartitions (x )) {
1674+ function (x , other , numPartitions = SparkR ::: getNumPartitionsRDD (x )) {
16751675 rdd1 <- map(x , function (v ) { list (v , NA ) })
16761676 rdd2 <- map(other , function (v ) { list (v , NA ) })
16771677
@@ -1714,7 +1714,7 @@ setMethod("zipPartitions",
17141714 if (length(rrdds ) == 1 ) {
17151715 return (rrdds [[1 ]])
17161716 }
1717- nPart <- sapply(rrdds , getNumPartitions )
1717+ nPart <- sapply(rrdds , getNumPartitionsRDD )
17181718 if (length(unique(nPart )) != 1 ) {
17191719 stop(" Can only zipPartitions RDDs which have the same number of partitions." )
17201720 }
0 commit comments