flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-1909) Refactor streaming scala api to use returns for adding typeinfo
Date Wed, 22 Apr 2015 12:50:59 GMT

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

ASF GitHub Bot commented on FLINK-1909:
---------------------------------------

Github user gyfora commented on a diff in the pull request:

    https://github.com/apache/flink/pull/610#discussion_r28868351
  
    --- Diff: flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
---
    @@ -632,15 +608,18 @@ public void registerType(Class<?> type) {
     	 * @return the data stream constructed
     	 */
     	@SuppressWarnings("unchecked")
    -	private <OUT> DataStreamSource<OUT> addSource(SourceFunction<OUT>
function,
    -			TypeInformation<OUT> outTypeInfo, String sourceName) {
    +	private <OUT> DataStreamSource<OUT> addSource(SourceFunction<OUT>
function, String sourceName) {
    +
    +		TypeInformation<OUT> outTypeInfo;
     
    -		if (outTypeInfo == null) {
    -			if (function instanceof GenericSourceFunction) {
    -				outTypeInfo = ((GenericSourceFunction<OUT>) function).getType();
    -			} else {
    +		if (function instanceof GenericSourceFunction) {
    +			outTypeInfo = ((GenericSourceFunction<OUT>) function).getType();
    +		} else {
    +			try {
     				outTypeInfo = TypeExtractor.createTypeInfo(SourceFunction.class,
     						function.getClass(), 0, null, null);
    +			} catch (InvalidTypesException e) {
    +				outTypeInfo = (TypeInformation<OUT>) new MissingTypeInfo("Custom source", e);
    --- End diff --
    
    This is the same mechanism that all flink operators use to allow missing types that can
be filled with .returns(..) afterwards.


> Refactor streaming scala api to use returns for adding typeinfo
> ---------------------------------------------------------------
>
>                 Key: FLINK-1909
>                 URL: https://issues.apache.org/jira/browse/FLINK-1909
>             Project: Flink
>          Issue Type: Improvement
>          Components: Scala API, Streaming
>            Reporter: Gyula Fora
>            Assignee: Gyula Fora
>
> Currently the streaming scala api uses transform to pass the extracted type information
instead of .returns. This leads to a lot of code duplication.



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

Mime
View raw message