You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Hafiz Mujadid <ha...@gmail.com> on 2015/07/26 22:43:57 UTC

Custom partitioner

Hi

I have csv data in which i have a column of date time. I want to partition
my data in 12 partitions with each partition containing data of one month
only. I am not getting how to write such partitioner and how to use that
partitioner to read write data.  

Kindly help me in this regard.

Thanks



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Custom-partitioner-tp24001.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Re: Custom partitioner

Posted by Ted Yu <yu...@gmail.com>.
You can write subclass of Partitioner whose getPartition() returns
partition number corresponding to the given key.

Take a look at
core/src/main/scala/org/apache/spark/api/python/PythonPartitioner.scala for
an example.

Cheers

On Sun, Jul 26, 2015 at 1:43 PM, Hafiz Mujadid <ha...@gmail.com>
wrote:

> Hi
>
> I have csv data in which i have a column of date time. I want to partition
> my data in 12 partitions with each partition containing data of one month
> only. I am not getting how to write such partitioner and how to use that
> partitioner to read write data.
>
> Kindly help me in this regard.
>
> Thanks
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/Custom-partitioner-tp24001.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
>
>