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

env.fromElements relies on the first input element for determining the DataSet/DataStream type

    XMLWordPrintableJSON

Details

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

    Description

      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

      DataStream<Event> input = env.fromElements(new Event(1, "a"), new SubEvent(2, "b"));
      

      succeeds, while the following

      DataStream<Event> input = env.fromElements(new SubEvent(1, "a"), new Event(2, "b"));
      

      fails with "java.lang.IllegalArgumentException: The elements in the collection are not all subclasses of SubEvent".

      Attachments

        Activity

          People

            Unassigned Unassigned
            vkalavri Vasia Kalavri
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: