Github user markhamstra commented on the pull request:
https://github.com/apache/spark/pull/3723#issuecomment-68216759
My biggest problem with this is that, while the existing `sample` is an
action, `sampleByCount` is another one of those unholy beasts that is neither
an action nor a transformation -- meaning that, while it transforms an RDD into
another RDD, it isn't lazy while doing so, but rather embeds several actions
(`count`) and makes use of another unholy beast (`zipWithIndex`), all of which
means that invoking `sampleByCount` eagerly launches several jobs in order to
create the new RDD.
This is by no means the only eager transformation (or whatever we end up
calling these unholy beasts), since there is a handful of others that already
exist in Spark; but I am really hesitant to add another. What we need is a
larger strategy and re-organization to properly handle, name and document eager
transformations, but that is well beyond the scope of this single PR. In the
meantime, eager transformations are just conveniences (inconveniences if you
are trying to launch jobs asynchronously) that packages up one or more actions.
They can always be broken up into multiple explicit and ordinary
transformations and actions (as Sean was effectively suggesting earlier), so
none of them are strictly necessary to achieve their functionality.
I'm really hesitant to add `sampleByCount` to the Spark API and thereby to
the list of eager transformations that we need to somehow fix in the future.
Perhaps a better way to handle such convenience packaging of transformations
and actions on RDDs is to include them in [Spark
Packages](http://spark-packages.org/).
---
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]