Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/3764#discussion_r22196879
--- Diff: python/pyspark/sql.py ---
@@ -2085,6 +2085,35 @@ def subtract(self, other, numPartitions=None):
else:
raise ValueError("Can only subtract another SchemaRDD")
+ def sample(self, withReplacement, fraction, seed=None):
+ """
+ Return a sampled subset of this SchemaRDD.
+
+ >>> srdd = sqlCtx.inferSchema(rdd)
+ >>> srdd.sample(False, 0.5, 97).count()
+ 2L
+ """
+ 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(
--- End diff --
Could you add sample() for JavaSchemaRDD()? Then this line could be changed
to use self._jschema_rdd.sample()
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]