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

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

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

    https://github.com/apache/flink/pull/610#discussion_r28868234
  
    --- 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 --
    
    Why did you change this?
    I suspect the exception will now be thrown somewhere else?


> 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)

Reply via email to