Skip to content

Commit b916442

Browse files
author
jbencook
committed
[SPARK-4860][pyspark][sql] adding sample() to JavaSchemaRDD
1 parent 020cbdf commit b916442

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sql/core/src/main/scala/org/apache/spark/sql/api/java/JavaSchemaRDD.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,10 @@ class JavaSchemaRDD(
218218
*/
219219
def subtract(other: JavaSchemaRDD, p: Partitioner): JavaSchemaRDD =
220220
this.baseSchemaRDD.subtract(other.baseSchemaRDD, p).toJavaSchemaRDD
221+
222+
/**
223+
* Return an RDD with a sampled version of the underlying dataset.
224+
*/
225+
def sample(withReplacement: Boolean, fraction: Double, seed: Long): JavaSchemaRDD =
226+
this.baseSchemaRDD.sample(withReplacement, fraction, seed).toJavaSchemaRDD
221227
}

0 commit comments

Comments
 (0)