flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Márton Balassi <balassi.mar...@gmail.com>
Subject Re: key
Date Mon, 30 Nov 2015 16:42:04 GMT
Hey Radu,

To add to Till's comment: do you need the whole Event type to be the key
are would you like to group the records based on the value of one of your
attributes (the 2 longs, int or string as mentioned)? If the latter is true
Flink comes with utilities to use standard types as keys. In the former
case Till's comment holds.

Best,

Marton

On Mon, Nov 30, 2015 at 5:38 PM, Till Rohrmann <trohrmann@apache.org> wrote:

> Hi Radu,
>
> if you want to use custom types as keys, then these custom types have to
> implement the Key interface.
>
> Cheers,
> Till
> ​
>
> On Mon, Nov 30, 2015 at 5:28 PM, Radu Tudoran <radu.tudoran@huawei.com>
> wrote:
>
>> Hi,
>>
>>
>>
>> I want to apply a “keyBy operator on a stream”.
>>
>> The string is of type MyEvent. This is a simple type that contains 2
>> longs and and int or string
>>
>>
>>
>> However, when applying this I get
>>
>>
>>
>> Exception in thread "main"
>> *org.apache.flink.api.common.InvalidProgramException*: This type
>> (GenericType<Event>) cannot be used as key.
>>
>>
>>
>> Can you give me a hint about a solution to this?
>>
>>
>>
>> Thanks
>>
>>
>>
>> Dr. Radu Tudoran
>>
>> Research Engineer
>>
>> IT R&D Division
>>
>>
>>
>> [image: cid:image007.jpg@01CD52EB.AD060EE0]
>>
>> HUAWEI TECHNOLOGIES Duesseldorf GmbH
>>
>> European Research Center
>>
>> Riesstrasse 25, 80992 München
>>
>>
>>
>> E-mail: *radu.tudoran@huawei.com <radu.tudoran@huawei.com>*
>>
>> Mobile: +49 15209084330
>>
>> Telephone: +49 891588344173
>>
>>
>>
>> HUAWEI TECHNOLOGIES Duesseldorf GmbH
>> Hansaallee 205, 40549 Düsseldorf, Germany, www.huawei.com
>> Registered Office: Düsseldorf, Register Court Düsseldorf, HRB 56063,
>> Managing Director: Jingwen TAO, Wanzhou MENG, Lifang CHEN
>> Sitz der Gesellschaft: Düsseldorf, Amtsgericht Düsseldorf, HRB 56063,
>> Geschäftsführer: Jingwen TAO, Wanzhou MENG, Lifang CHEN
>>
>> This e-mail and its attachments contain confidential information from
>> HUAWEI, which is intended only for the person or entity whose address is
>> listed above. Any use of the information contained herein in any way
>> (including, but not limited to, total or partial disclosure, reproduction,
>> or dissemination) by persons other than the intended recipient(s) is
>> prohibited. If you receive this e-mail in error, please notify the sender
>> by phone or email immediately and delete it!
>>
>>
>>
>
>

Mime
View raw message