aljoscha commented on a change in pull request #13521:
URL: https://github.com/apache/flink/pull/13521#discussion_r500090695



##########
File path: 
flink-core/src/main/java/org/apache/flink/configuration/ConfigConstants.java
##########
@@ -383,7 +383,9 @@
 
        /**
         * Whether to use the LargeRecordHandler when spilling.
+        * @deprecated use {@link AlgorithmOptions#USE_LARGE_RECORDS_HANDLER}

Review comment:
       Can't we remove them right away? This is such an obscure feature. But 
it's also fine like this.

##########
File path: 
flink-core/src/test/java/org/apache/flink/api/common/typeutils/ComparatorTestBase.java
##########
@@ -84,8 +88,10 @@ public void testDuplicate() {
        
        @Test
        public void testEquality() {
-               testEquals(true);
-               testEquals(false);
+               for (boolean ascending : getTestedOrder()) {

Review comment:
       Here we're just testing the same things twice, right?

##########
File path: 
flink-core/src/test/java/org/apache/flink/api/common/typeutils/ComparatorTestBase.java
##########
@@ -45,6 +45,10 @@
        // Same as in the NormalizedKeySorter
        private static final int DEFAULT_MAX_NORMALIZED_KEY_LEN = 8;
 
+       protected boolean[] getTestedOrder() {
+               return new boolean[] {true, false};

Review comment:
       (it was @tillrohrmann, btw)

##########
File path: 
flink-core/src/test/java/org/apache/flink/api/common/typeutils/ComparatorTestBase.java
##########
@@ -45,6 +45,10 @@
        // Same as in the NormalizedKeySorter
        private static final int DEFAULT_MAX_NORMALIZED_KEY_LEN = 8;
 
+       protected boolean[] getTestedOrder() {
+               return new boolean[] {true, false};

Review comment:
       Recently someone told me that `booleans` are hard to maintain because 
you don't immediately see what the `true` /`false` really means. You could use 
`Order.ASCENDING` and `Order.DESCENDING` here instead.

##########
File path: 
flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/SortingBoundedInputITCase.java
##########
@@ -0,0 +1,194 @@
+/*
+ * 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.streaming.runtime;
+
+import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
+import org.apache.flink.api.common.typeinfo.PrimitiveArrayTypeInfo;
+import org.apache.flink.api.common.typeutils.base.LongSerializer;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.api.java.typeutils.TupleTypeInfo;
+import org.apache.flink.core.execution.JobClient;
+import org.apache.flink.core.memory.ManagedMemoryUseCase;
+import org.apache.flink.streaming.api.datastream.DataStreamSource;
+import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+import org.apache.flink.streaming.api.graph.StreamGraph;
+import org.apache.flink.streaming.api.operators.AbstractStreamOperator;
+import org.apache.flink.streaming.api.operators.BoundedOneInput;
+import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
+import org.apache.flink.streaming.api.operators.collect.CollectResultIterator;
+import org.apache.flink.streaming.api.operators.collect.CollectSinkOperator;
+import 
org.apache.flink.streaming.api.operators.collect.CollectSinkOperatorFactory;
+import org.apache.flink.streaming.api.operators.collect.CollectStreamSink;
+import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import org.apache.flink.util.CollectionUtil;
+import org.apache.flink.util.SplittableIterator;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.Random;
+import java.util.Set;
+import java.util.UUID;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+
+/**
+ * An end to end test for sorted inputs for a keyed operator with bounded 
inputs.
+ */
+public class SortingBoundedInputITCase {
+       @Test
+       public void testOneInputOperator() throws Exception {
+               long numberOfRecords = 1_000_000;
+               StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
+               DataStreamSource<Tuple2<Integer, byte[]>> elements = 
env.fromParallelCollection(
+                       new InputGenerator(numberOfRecords),
+                       new TupleTypeInfo<>(BasicTypeInfo.INT_TYPE_INFO, 
PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO)
+               );
+
+               SingleOutputStreamOperator<Long> counts = elements
+                       .keyBy(element -> element.f0)
+                       .transform(
+                               "Asserting operator",
+                               BasicTypeInfo.LONG_TYPE_INFO,
+                               new AssertingOperator()
+                       );
+
+               // TODO we should replace this block with 
DataStreamUtils#collect once
+               // we have the automatic runtime mode determination in place.
+               CollectResultIterator<Long> collectedCounts = applyCollect(env, 
counts);

Review comment:
       Wouldn't one of the recently reworked `DataStreamUtils.collect()` 
methods work here?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to