Is the tuple itself not aware of the key fields ? I'm thinking about the
file in Malhar:

*demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/CalculatorOperator.java*

and the *MachineInfoStreamCodec* in it.

Ram

On Tue, Apr 26, 2016 at 3:48 AM, Bhupesh Chawda <bhup...@datatorrent.com>
wrote:

> Hi,
>
> I am trying to write a stream codec to set on the input port of an
> operator which is partitioned.
>
> The use case is to route incoming tuples to the operator partitions such
> that the tuple with the same key goes to the same partition.
>
> However, the tuple key fields are known only to the operator. Is there a
> way I can use this information to construct the StreamCodec such that the
> getPartition() method of the codec returns the hashcode of the tuple key
> field.
>
> If this is not possible, then is there a way I can have properties in the
> Stream codec and set them externally similar to operator properties?
>
> Thanks.
>
> ~Bhupesh
>

Reply via email to