Re: Finding the Maximum Value Received so far in a Stream

2019-10-06 Thread Komal Mariam
Thank you for your help all. I understand now and made the changes. Since I needed return the entire object that contained the max value of X, I used reduce instead of max.

Re: Finding the Maximum Value Received so far in a Stream

2019-10-04 Thread Theo Diefenthal
maximum per fish-id. If you want to have a global maximum, you should not key by fish_id first. Best regards Theo Von: "Komal Mariam" An: "Jörn Franke" CC: "user" Gesendet: Donnerstag, 3. Oktober 2019 11:01:54 Betreff: Re: Finding the Maximum Value Received

Re: Finding the Maximum Value Received so far in a Stream

2019-10-03 Thread Komal Mariam
Hi Jörn! Thanks for your suggestions. Btw just a correction in the Fish class it's "public Point point" not "public Point coordinate". For double type comparison, I implemented what you suggested and used BigDecimal for their comparison. I'm still getting the same results where I see smaller va

Re: Finding the Maximum Value Received so far in a Stream

2019-10-03 Thread Jörn Franke
Btw. Why don’t you use the max method? https://ci.apache.org/projects/flink/flink-docs-master/api/java/org/apache/flink/streaming/api/datastream/KeyedStream.html#max-java.lang.String- See here about the state solution: https://ci.apache.org/projects/flink/flink-docs-release-1.2/dev/stream/stat

Re: Finding the Maximum Value Received so far in a Stream

2019-10-03 Thread Jörn Franke
You can not compare doubles in Java (and other languages). Reason is that double has a limited precision and is rounded. See here for some examples and discussion: https://howtodoinjava.com/java/basics/correctly-compare-float-double/ Am 03.10.2019 um 08:26 schrieb Komal Mariam : > >  > Hello a

Finding the Maximum Value Received so far in a Stream

2019-10-02 Thread Komal Mariam
Hello all, I'm trying to do a fairly simple task that is to find the maximum value (Double) received so far in a stream. This is what I implemented: POJO class: public class Fish{ public Integer fish_id; public Point coordinate; //position public Fish() {}; public Fish(fish_id,double x