Github user mattf commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2383#discussion_r17542165
  
    --- Diff: python/pyspark/rdd.py ---
    @@ -353,7 +353,7 @@ def func(iterator):
                 return ifilter(f, iterator)
             return self.mapPartitions(func, True)
     
    -    def distinct(self):
    +    def distinct(self, numPartitions=None):
             """
    --- End diff --
    
    i can do that.
    
    fyi, i ran into some problems initially...
    
    ```
    from pyspark import sql
    ssc = sql.SQLContext(sc)
    rdd = sc.parallelize(['{"a": 1}', '{"b": 2}', '{"c": 3}']*10)
    srdd = ssc.jsonRDD(rdd)
    srdd.distinct(10)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File 
"/home/matt/Documents/Repositories/spark/dist/python/pyspark/sql.py", line 
1703, in distinct
        rdd = self._jschema_rdd.distinct(numPartitions)
      File 
"/home/matt/Documents/Repositories/spark/dist/python/lib/py4j-0.8.2.1-src.zip/py4j/java_gateway.py",
 line 538, in __call__
      File 
"/home/matt/Documents/Repositories/spark/dist/python/lib/py4j-0.8.2.1-src.zip/py4j/protocol.py",
 line 304, in get_return_value
    py4j.protocol.Py4JError: An error occurred while calling o32.distinct. 
Trace:
    py4j.Py4JException: Method distinct([class java.lang.Integer]) does not 
exist
        at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:333)
        at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:342)
        at py4j.Gateway.invoke(Gateway.java:252)
        at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133)
        at py4j.commands.CallCommand.execute(CallCommand.java:79)
        at py4j.GatewayConnection.run(GatewayConnection.java:207)
        at java.lang.Thread.run(Thread.java:745)
    ```


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to