Hello Aljoscha,
I have also tried by using the field's name in the sum("field3") function
(like you have suggested), but this time the exception is different:
--------------------------------------------------------------------
Exception in thread "main" java.lang.ExceptionInInitializerError
at
org.apache.flink.quickstart.StreamWindowExperiments.MultiWindowing.main(MultiWindowing.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.lang.IllegalArgumentException: Key expressions are only
supported on POJO types and Tuples. A type is considered a POJO if all its
fields are public, or have both getters and setters defined
at
org.apache.flink.streaming.util.FieldAccessor$PojoFieldAccessor.<init>(FieldAccessor.java:175)
at
org.apache.flink.streaming.util.FieldAccessor.create(FieldAccessor.java:92)
at
org.apache.flink.streaming.api.functions.aggregation.SumAggregator.<init>(SumAggregator.java:49)
at
org.apache.flink.streaming.api.datastream.WindowedStream.sum(WindowedStream.java:390)
at
org.apache.flink.quickstart.StreamWindowExperiments.MultiWindowing$.<init>(MultiWindowing.scala:63)
at
org.apache.flink.quickstart.StreamWindowExperiments.MultiWindowing$.<clinit>(MultiWindowing.scala)
... 6 more
---------------------------------------------------------------------
I have used both of the styles of calling sum() in earlier, but I never got
this exception. That's why I am a little confused. 'Reading' is a _case
class_ and hence, a POJO as I understand. Yet, the message seems to say
that it is not.
-- Nirmalya
--
Software Technologist
http://www.linkedin.com/in/nirmalyasengupta
"If you have built castles in the air, your work need not be lost. That is
where they should be.
Now put the foundation under them."