flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From greghogan <...@git.apache.org>
Subject [GitHub] flink issue #5047: Code refine of WordWithCount
Date Wed, 22 Nov 2017 15:41:04 GMT
Github user greghogan commented on the issue:

    This change doesn't work since `WordWithCount` needs to be a POJO which requires a default
or no-args constructor and non-final public attributes or getters/setters. Since the type
is not a POJO the `TypeExtractor` falls back to `GenericType`, which cannot be used as a key
type as noted in the error message:
    Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.949 sec <<<
FAILURE! - in org.apache.flink.streaming.test.socket.SocketWindowWordCountITCase
    testJavaProgram(org.apache.flink.streaming.test.socket.SocketWindowWordCountITCase)  Time
elapsed: 0.045 sec  <<< ERROR!
    org.apache.flink.api.common.InvalidProgramException: This type (GenericType<org.apache.flink.streaming.examples.socket.SocketWindowWordCount.WordWithCount>)
cannot be used as key.
    	at org.apache.flink.api.common.operators.Keys$ExpressionKeys.<init>(Keys.java:330)
    	at org.apache.flink.streaming.api.datastream.DataStream.keyBy(DataStream.java:295)
    	at org.apache.flink.streaming.examples.socket.SocketWindowWordCount.main(SocketWindowWordCount.java:79)
    	at org.apache.flink.streaming.test.socket.SocketWindowWordCountITCase.testJavaProgram(SocketWindowWordCountITCase.java:65)


View raw message