spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tdas <...@git.apache.org>
Subject [GitHub] spark pull request: Spark 1857 improve error message when trying p...
Date Tue, 20 May 2014 02:24:15 GMT
Github user tdas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/831#discussion_r12825699
  
    --- 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 --
    
    I do get the point. I guess my primary concern in public API change; we really dont want
to be changing RDD API change if there are ways around it. Specially adding `getPartitioner`
is not the right way, as that gives the users two methods `RDD.partitioner` and `RDD.getPartitioner`
to access partitions. Thats confusing. 
    
    The right way should be `RDD.partitioner` be converted from val to def. It will use a
internal private field called `partitioner_`  to store the partitioner and check for null.
See `RDD.partitions` or `RDD.dependencies` for reference. 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message