You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/04/06 10:10:25 UTC
[jira] [Commented] (FLINK-3444) env.fromElements relies on the
first input element for determining the DataSet/DataStream type
[ https://issues.apache.org/jira/browse/FLINK-3444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15227923#comment-15227923 ]
ASF GitHub Bot commented on FLINK-3444:
---------------------------------------
GitHub user gallenvara opened a pull request:
https://github.com/apache/flink/pull/1857
[FLINK-3444] env.fromElements relies on the first input element for determining the DataSet/DataStream type
Add fromElements method with based class type to avoid the exception.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/gallenvara/flink flink-3444
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/1857.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1857
----
commit 1eac212afa448984817f36f05ae931d4f0fa4ab9
Author: gallenvara <ga...@126.com>
Date: 2016-04-06T08:04:32Z
Add fromElements method with based class type to avoid the exception.
----
> 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
>
> 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)