apex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raja.Aravapalli <Raja.Aravapa...@target.com>
Subject Re: hashing
Date Thu, 07 Jul 2016 20:28:27 GMT


Also, to share some info on the parititoner I am using:

I am using Stateless Partitioner with below code:


<property>
    <name>dt.operator.MyOperator.attr.PARTITIONER</name>
    <value>com.datatorrent.common.partitioner.StatelessPartitioner:3</value>
</property>

Thanks.

Regards,
Raja.

From: "Raja.Aravapalli" <Raja.Aravapalli@target.com<mailto:Raja.Aravapalli@target.com>>
Date: Thursday, July 7, 2016 at 3:20 PM
To: "users@apex.apache.org<mailto:users@apex.apache.org>" <users@apex.apache.org<mailto:users@apex.apache.org>>
Subject: hashing


Hi,

I have an operator, which is running in 3 instances I.e partions… And, I want all the records
with same key, here my key is "String" type, to be transferred to same instance/partition.

But, I am unable to achieve this with my below codec.



import com.datatorrent.lib.codec.KryoSerializableStreamCodec;

public class MyCodec extends KryoSerializableStreamCodec<String> {

    @Override
    public int getPartition(String tuple) {

        String[] toSplit = tuple.split("\\^");
        String exId = toSplit[1];

        return exId.hashCode();

    }

}


Any guidance please…


Thanks a lot.


Regards,
Raja.
Mime
View raw message