flink-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephan Ewen (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FLINK-2788) Add type hint with TypeExtactor call on Hint Type
Date Tue, 29 Sep 2015 22:05:04 GMT
Stephan Ewen created FLINK-2788:

             Summary: Add type hint with TypeExtactor call on Hint Type
                 Key: FLINK-2788
                 URL: https://issues.apache.org/jira/browse/FLINK-2788
             Project: Flink
          Issue Type: Improvement
          Components: Core
    Affects Versions: 0.10
            Reporter: Stephan Ewen
             Fix For: 0.10

As per discussion with [~aljoscha]

A very good and type safe way to supply type hints would be the following:

Define a hint class that takes a generic parameter.
public abstract class TypeHint<T> {}

The hints would have the following method:
public DataSet<T> returns(TypeHint<T> hint);

It would be used like this:
DataSet<Sting> data = ...;
  .flatMap( (String str, Collector<Integer> out) -> out.collect(str.length()) )
  .returns( new TypeHint<Integer>() {})

This would create an inline subclass of the hint, from which the type could be extracted.
The generics would ensure that it is typesafe.

This message was sent by Atlassian JIRA

View raw message