[ https://issues.apache.org/jira/browse/FLINK-9031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16408636#comment-16408636 ]
ASF GitHub Bot commented on FLINK-9031: --------------------------------------- GitHub user fhueske opened a pull request: https://github.com/apache/flink/pull/5742 [FLINK-9031] Fix DataSet Union operator translation bug. ## What is the purpose of the change - Fixes a bug reported in [FLINK-9031](https://issues.apache.org/jira/browse/FLINK-9031) - Union nodes had a partitioning strategy on the outgoing channel, that was (intentionally) not translated by the `JobGraphGenerator` because the `JobGraphGenerator` assumed that Union nodes would always have outgoing FORWARD strategies. - Not translating the partitioning resulted in an incorrect result because data was not correctly distributed. ## Brief change log - Add a check in `JobGraphGenerator` to fail if a union node with non-FORWARD outgoing strategy is found. - Add a pre-optimization plan traversal that fixes the strategy of union outputs to FORWARD. - Add a test based on a simplified version of the reported program. ## Verifying this change - Run the added test. ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): **no** - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: **no** - The serializers: **no** - The runtime per-record code paths (performance sensitive): **no** - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: **no** - The S3 file system connector: **no** ## Documentation - Does this pull request introduce a new feature? **no** - If yes, how is the feature documented? **n/a** You can merge this pull request into a Git repository by running: $ git pull https://github.com/fhueske/flink dataSetUnionBug Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/5742.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #5742 ---- commit 3939f06bacaf1595844de56fe58651732b89592e Author: Fabian Hueske <fhueske@...> Date: 2018-03-21T19:54:05Z [FLINK-9031] Fix DataSet Union operator translation bug. - Adds a pass over the pre-optimized plan that fixes the output strategy of union nodes to FORWARD. ---- > DataSet Job result changes when adding rebalance after union > ------------------------------------------------------------ > > Key: FLINK-9031 > URL: https://issues.apache.org/jira/browse/FLINK-9031 > Project: Flink > Issue Type: Bug > Components: DataSet API, Local Runtime, Optimizer > Affects Versions: 1.3.1 > Reporter: Fabian Hueske > Priority: Critical > Attachments: Person.java, RunAll.java, newplan.txt, oldplan.txt > > > A user [reported this issue on the user mailing > list|https://lists.apache.org/thread.html/075f1a487b044079b5d61f199439cb77dd4174bd425bcb3327ed7dfc@%3Cuser.flink.apache.org%3E]. > {quote}I am using Flink 1.3.1 and I have found a strange behavior on running > the following logic: > # Read data from file and store into DataSet<POJO> > # Split dataset in two, by checking if "field1" of POJOs is empty or not, so > that the first dataset contains only elements with non empty "field1", and > the second dataset will contain the other elements. > # Each dataset is then grouped by, one by "field1" and other by another > field, and subsequently reduced. > # The 2 datasets are merged together by union. > # The final dataset is written as json. > What I was expected, from output, was to find only one element with a > specific value of "field1" because: > # Reducing the first dataset grouped by "field1" should generate only one > element with a specific value of "field1". > # The second dataset should contain only elements with empty "field1". > # Making an union of them should not duplicate any record. > This does not happen. When i read the generated jsons i see some duplicate > (non empty) values of "field1". > Strangely this does not happen when the union between the two datasets is > not computed. In this case the first dataset produces elements only with > distinct values of "field1", while second dataset produces only records with > empty field "value1". > {quote} > The user has not enable object reuse. > Later he reports that the problem disappears when he injects a rebalance() > after a union resolves the problem. I had a look at the execution plans for > both cases (attached to this issue) but could not identify a problem. > Hence I assume, this might be an issue with the runtime code but we need to > look deeper into this. The user also provided an example program consisting > of two classes which are attached to the issue as well. > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)