Github user JoshRosen commented on the pull request:

    https://github.com/apache/spark/pull/3795#issuecomment-68092486
  
    I've pushed a commit which adds warnings in the PairRDDFunctions 
constructor.  Here's what that looks like in the REPL:
    
    ```scala
    scala> arrayPairs.groupByKey()
    14/12/24 23:48:19 WARN PairRDDFunctions: Using arrays as keys may lead to 
incorrect results (see SPARK-597)
    org.apache.spark.SparkException: HashPartitioner cannot partition array 
keys (see SPARK-597)
        at 
org.apache.spark.Partitioner$.assertPartitionerSupportsKeyClass(Partitioner.scala:84)
        at 
org.apache.spark.rdd.PairRDDFunctions.combineByKey(PairRDDFunctions.scala:91)
        at 
org.apache.spark.rdd.PairRDDFunctions.groupByKey(PairRDDFunctions.scala:452)
    [...]
    ```
    
    In this case, we first get the warning when the constructor is called, and 
get the exception because the default HashPartitioner was used.
    
    Here's a case where we run successfully, because the method does not try to 
hash the keys, but still log a warning:
    
    ```scala
    scala> arrayPairs.mapValues(x => 2 * x).values
    14/12/24 23:52:44 WARN PairRDDFunctions: Using arrays as keys may lead to 
incorrect results (see SPARK-597)
    14/12/24 23:52:44 WARN PairRDDFunctions: Using arrays as keys may lead to 
incorrect results (see SPARK-597)
    res0: org.apache.spark.rdd.RDD[Int] = MapPartitionsRDD[3] at values at 
<console>:15
    ```
    
    In this case, the PairRDDFunctions constructor was invoked twice, hence two 
warnings.


---
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]

Reply via email to