Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.10.0, 1.0.0
-
None
Description
The fromElements method of the ExecutionEnvironment and StreamExecutionEnvironment determines the DataSet/DataStream type by extracting the type of the first input element.
This is problematic if the first element is a subtype of another element in the collection.
For example, the following
DataStream<Event> input = env.fromElements(new Event(1, "a"), new SubEvent(2, "b"));
succeeds, while the following
DataStream<Event> input = env.fromElements(new SubEvent(1, "a"), new Event(2, "b"));
fails with "java.lang.IllegalArgumentException: The elements in the collection are not all subclasses of SubEvent".