[
https://issues.apache.org/jira/browse/FLINK-3254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15126353#comment-15126353
]
ASF GitHub Bot commented on FLINK-3254:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/1568#discussion_r51428276
--- Diff:
flink-tests/src/test/java/org/apache/flink/test/javaApiOperators/ReduceWithCombinerITCase.java
---
@@ -0,0 +1,377 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.test.javaApiOperators;
+
+import org.apache.flink.api.common.functions.CombineFunction;
+import org.apache.flink.api.common.functions.GroupCombineFunction;
+import org.apache.flink.api.common.functions.GroupReduceFunction;
+import org.apache.flink.api.java.DataSet;
+import org.apache.flink.api.java.ExecutionEnvironment;
+import org.apache.flink.api.java.functions.KeySelector;
+import org.apache.flink.api.java.operators.UnsortedGrouping;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.api.java.tuple.Tuple3;
+import org.apache.flink.test.util.MultipleProgramsTestBase;
+import org.apache.flink.util.Collector;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+@SuppressWarnings("serial")
+@RunWith(Parameterized.class)
+public class ReduceWithCombinerITCase extends MultipleProgramsTestBase {
+
+ public ReduceWithCombinerITCase(TestExecutionMode mode) {
+ super(TestExecutionMode.CLUSTER);
+ }
+
+ @Test
+ public void testReduceOnNonKeyedDataset() throws Exception {
+
+ final ExecutionEnvironment env =
ExecutionEnvironment.getExecutionEnvironment();
+ env.setParallelism(4);
+
+ // creates the input data and distributes them evenly among the
available downstream tasks
+ DataSet<Tuple2<Integer, Boolean>> input =
createNonKeyedInput(env);
+
+ List<Tuple2<Integer, Boolean>> actual = input.reduceGroup(new
NonKeyedCombReducer()).collect();
+ List<Tuple2<Integer, Boolean>> expected =
Collections.singletonList(new Tuple2<>(10, true));
+
+ compareResultCollections(expected, actual, new
Comparator<Tuple2<Integer, Boolean>>() {
--- End diff --
Can you use `compareResultAsText` or `compareResultAsTuples` to make the
tests more concise?
> CombineFunction interface not respected
> ---------------------------------------
>
> Key: FLINK-3254
> URL: https://issues.apache.org/jira/browse/FLINK-3254
> Project: Flink
> Issue Type: Bug
> Components: DataSet API
> Affects Versions: 1.0.0, 0.10.1
> Reporter: Fabian Hueske
> Assignee: Kostas
> Priority: Blocker
> Fix For: 1.0.0
>
>
> The DataSet API offers a {{CombineFunction}} interface, which differs from
> the {{GroupCombineFunction}} interface by being restricted to return a single
> value instead of returning arbitrary many values through a {{Collector}}.
> The JavaDocs of the {{GroupCombineFunction}} point to the {{CombineFunction}}
> interface, advertising it as more efficient.
> However, the {{CombineFunction}} interface is nor respected by Flink, i.e., a
> {{GroupReduceFunction}} that implements this interface is executed without
> leveraging the combine method.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)