Github user holdenk commented on a diff in the pull request:
https://github.com/apache/spark/pull/831#discussion_r12824928
--- Diff: core/src/main/scala/org/apache/spark/rdd/RDD.scala ---
@@ -118,8 +118,25 @@ abstract class RDD[T: ClassTag](
// Methods and fields available on all RDDs
//
=======================================================================
+ /** Accessor method which throws a runtime exception if null. This lets
us have
+ a clearer error method when attempting to perform operations on an RDD
inside of
+ a parallel operation as the partitioner is marked as transient */
+ def getPartitioner: Option[Partitioner] = {
+ partitioner match {
+ case null => throw new SparkException("Actions on RDDs inside of
another RDD operation are " +
+ "not supported")
+ case _ => partitioner
+ }
+ }
+
/** The SparkContext that created this RDD. */
- def sparkContext: SparkContext = sc
+ def sparkContext: SparkContext = {
--- End diff --
Its a NPE. Matei suggested replacing it with a less obtuse error message in
https://issues.apache.org/jira/browse/SPARK-1857 . I think this is a better
place to put the check since:
1) Other people might try and access the partitioner and then they get
sensible error messages
2) Checking for a NPE inside of the lookup() function isn't any more
intuitive
3) We already need to add a similar check to context/SparkContext here
---
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.
---