[ 
https://issues.apache.org/jira/browse/FLINK-3444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15261720#comment-15261720
 ] 

Till Rohrmann commented on FLINK-3444:
--------------------------------------

What kind of cases would that be? I mean the pure var arg implementation is 
also capable of finding the common super type for the provided set of elements. 
Thus, I think we should be able to do the same.

Moreover, in case that the user provides a wrong {{Class<T>}} instance, then 
the pure var arg method is called where the common super type is {{Object}}. 
This is completely intransparent to the user and thus confusing. I think this 
should be fixed by not allowing the compiler to compile these kind of programs 
or by automatically inferring the common super type.

> env.fromElements relies on the first input element for determining the 
> DataSet/DataStream type
> ----------------------------------------------------------------------------------------------
>
>                 Key: FLINK-3444
>                 URL: https://issues.apache.org/jira/browse/FLINK-3444
>             Project: Flink
>          Issue Type: Bug
>          Components: DataSet API, DataStream API
>    Affects Versions: 0.10.0, 1.0.0
>            Reporter: Vasia Kalavri
>             Fix For: 1.1.0
>
>
> 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
> {code}
> DataStream<Event> input = env.fromElements(new Event(1, "a"), new SubEvent(2, 
> "b"));
> {code}
> succeeds, while the following
> {code}
> DataStream<Event> input = env.fromElements(new SubEvent(1, "a"), new Event(2, 
> "b"));
> {code}
> fails with "java.lang.IllegalArgumentException: The elements in the 
> collection are not all subclasses of SubEvent".



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to