flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AndreaKinn <kinn6...@hotmail.it>
Subject Problems with window function
Date Sat, 14 Oct 2017 23:00:55 GMT
Hi all,
I'm trying to implement a time ordering inside a stream using window
function. Then my purposes is to order the element inside a tumbling window.

This is my code (written following the doc):

DataStream<Harness.KafkaRecord> LCxAccStream = env
				.addSource(new FlinkKafkaConsumer010<>("LCacc", new
CustomDeserializer(), properties)).setParallelism(4)
				.map(new MapFunction<Tuple8&lt;String, String, Date, String, String,
Double, Double, Double>, Harness.KafkaRecord>(){ 

					public Harness.KafkaRecord map(Tuple8<String, String, Date, String,
String, Double, Double, Double> value) throws Exception { 
						return new Harness.KafkaRecord(value.f0, value.f1, value.f2, value.f3,
value.f4, value.f5); 
				.apply(new WindowFunction<Harness.KafkaRecord, Harness.KafkaRecord,
String, TimeWindow>() {
					public void apply(String key, 
							TimeWindow window, 
							Iterable<Harness.KafkaRecord> input, 
							Collector<Harness.KafkaRecord> out)
							throws Exception {
						 ArrayList<Harness.KafkaRecord> list = new
						 for (Harness.KafkaRecord in: input) 
						 for(Harness.KafkaRecord output: list)

Clearly I have defined a comparator for Harness.KafkaRecord object.
Unfortunately the method .apply(...) shows the following error:

/The method apply(WindowFunction<Harness.KafkaRecord,R,Tuple,TimeWindow>) in
the type WindowedStream<Harness.KafkaRecord,Tuple,TimeWindow> is not
applicable for the arguments (new

Honestly I don't understand why I can't use String instead of Tuple. Btw my
key type is a String and moreover I can't understand what could means the
type Tuple in this case.

Furthermore I noted that in the example here:  WindowFunction - The Generic
it use a String type as key of the KeyedStream.

Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/

View raw message