spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Apache Spark (JIRA)" <>
Subject [jira] [Assigned] (SPARK-9821) pyspark reduceByKey should allow a custom partitioner
Date Wed, 02 Sep 2015 07:29:47 GMT


Apache Spark reassigned SPARK-9821:

    Assignee: Apache Spark

> pyspark reduceByKey should allow a custom partitioner
> -----------------------------------------------------
>                 Key: SPARK-9821
>                 URL:
>             Project: Spark
>          Issue Type: Improvement
>          Components: PySpark
>    Affects Versions: 1.3.0
>            Reporter: Diana Carroll
>            Assignee: Apache Spark
>            Priority: Minor
> In Scala, I can supply a custom partitioner to reduceByKey (and other aggregation/repartitioning
methods like aggregateByKey and combinedByKey), but as far as I can tell from the Pyspark
API, there's no way to do the same in Python.
> Here's an example of my code in Scala:
> {code} => (getFileType(s), 1)).reduceByKey(new FileTypePartitioner(),_+_){code}
> But I can't figure out how to do the same in Python.  The closest I can get is to call
repartition before reduceByKey like so:
> {code} s: (getFileType(s), 1)).partitionBy(3,hash_filetype).reduceByKey(lambda
v1,v2: v1+v2).collect(){code}
> But that defeats the purpose, because I'm shuffling twice instead of once, so my performance
is worse instead of better.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message