Hi,
I was trying to test some specific issue, but now I cannot seem to get the very basic case working. It is most likely that I am blind to something, would anyone have quick look at it?
It is just a collection of pojos where I am just trying to keyBy one field and sum into the other, but I am getting:
5> PojoExample{count=0, productId='productA'}
8> PojoExample{count=0, productId='productB'}
5> PojoExample{count=0, productId='productA'}
8> PojoExample{count=0, productId='productB'}
5> PojoExample{count=0, productId='productA'}
5> PojoExample{count=0, productId='productA'}
5> PojoExample{count=0, productId='productA’}
Regards,
-Rami
|
Conditions for a class to be treated as a POJO by Flink:
I don't know whether you need to implement also hashCode() and equals() actually On Mon, May 23, 2016 at 3:24 PM, Al-Isawi Rami <[hidden email]> wrote:
|
Thanks Flavio, but as you can see in my code I have already declared my pojo to achieve those conditions:
So it cannot be that.
-Rami
|
You don't have getters and setters for count and productId.
Your class should be public class PojoExample { public int count; public String productId; public PojoExample() {} public int getCount() { return count; } public void setCount(int count) { this.count = count; } public String getProductId() { return productId; } public void setProductId(String productId) { this.productId = productId; } } On Mon, May 23, 2016 at 3:40 PM, Al-Isawi Rami <[hidden email]> wrote:
|
Thanks, setters and getters for public fields have no purpose. Also per the conditions you have mentioned:
"All fields either have to be public
or there must be getters and setters for all non-public fields.”
Since my fields are declared public there are no impact on adding getters and setters. ( I have also testing after adding the setters and getters and as expected that has no effect).
Could you spot anything else? this should be really easy basic case. I am really wondering why it is not working.
For the people who are lazy to open the gist code snippet, this is what I am trying to do:
Regards,
-Rami
|
Sorry Rami, you're right :) Unfortunattely I've never used Flink streaming so I cannot be helpful there..On Mon, May 23, 2016 at 5:06 PM, Al-Isawi Rami <[hidden email]> wrote:
|
Can you try serializing your POJO ? ThanksOn Mon, May 23, 2016 at 8:42 PM, Flavio Pompermaier <[hidden email]> wrote:
-- |
Actually, the program works correctly (according to the DataStream API) Let me explain what happens:3) By calling sum() on a KeyedStream you compute a running aggregate which emits one record for each incoming record summing the declared field (this stays 0 because 0 + 0 = 0). You will need to 1) initialize count to 1 2) define window to discretize the stream into finite sets (windows) of records. Cheers, Fabian 2016-05-23 17:16 GMT+02:00 Deepak Sharma <[hidden email]>:
|
Free forum by Nabble | Edit this page |