Skip to content

Commit

Permalink
[SPARK-4860][pyspark][sql] using sample() method from JavaSchemaRDD
Browse files Browse the repository at this point in the history
  • Loading branch information
jbencook committed Dec 23, 2014
1 parent b916442 commit de22f70
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions python/pyspark/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -2095,9 +2095,8 @@ def sample(self, withReplacement, fraction, seed=None):
"""
assert fraction >= 0.0, "Negative fraction value: %s" % fraction
seed = seed if seed is not None else random.randint(0, sys.maxint)
rdd = self._jschema_rdd.baseSchemaRDD().sample(
withReplacement, fraction, long(seed))
return SchemaRDD(rdd.toJavaSchemaRDD(), self.sql_ctx)
rdd = self._jschema_rdd.sample(withReplacement, fraction, long(seed))
return SchemaRDD(rdd, self.sql_ctx)

def takeSample(self, withReplacement, num, seed=None):
"""Return a fixed-size sampled subset of this SchemaRDD.
Expand Down

0 comments on commit de22f70

Please sign in to comment.