Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-2788

Add type hint with TypeExtactor call on Hint Type

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.10.0
    • 1.0.0, 1.1.0
    • None
    • None

    Description

      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 = ...;
      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.

      Attachments

        Activity

          People

            sewen Stephan Ewen
            sewen Stephan Ewen
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: