azagrebin commented on a change in pull request #7288: [FLINK-9702] Improvement 
in (de)serialization of keys and values for RocksDB state
URL: https://github.com/apache/flink/pull/7288#discussion_r241707867
 
 

 ##########
 File path: 
flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBSerializedCompositeKeyBuilderTest.java
 ##########
 @@ -0,0 +1,250 @@
+/*
+ * 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.contrib.streaming.state;
+
+import org.apache.flink.api.common.typeutils.TypeSerializer;
+import org.apache.flink.api.common.typeutils.base.IntSerializer;
+import org.apache.flink.api.common.typeutils.base.StringSerializer;
+import org.apache.flink.core.memory.DataInputDeserializer;
+import org.apache.flink.core.memory.DataOutputSerializer;
+import org.apache.flink.runtime.state.KeyGroupRangeAssignment;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+
+/**
+ * Test for @{@link RocksDBSerializedCompositeKeyBuilder}.
+ */
+public class RocksDBSerializedCompositeKeyBuilderTest {
+
+       private final DataOutputSerializer dataOutputSerializer = new 
DataOutputSerializer(128);
+
+       private static final int[] TEST_PARALLELISMS = new int[]{64, 4096};
+       private static final Collection<Integer> TEST_INTS = Arrays.asList(42, 
4711);
+       private static final Collection<String> TEST_STRINGS = 
Arrays.asList("test123", "abc");
+
+       @Before
+       public void before() {
+               dataOutputSerializer.clear();
+       }
+
+       @Test
+       public void testSetKey() throws IOException {
+               for (int parallelism : TEST_PARALLELISMS) {
+                       testSetKeyInternal(IntSerializer.INSTANCE, TEST_INTS, 
parallelism);
+                       testSetKeyInternal(StringSerializer.INSTANCE, 
TEST_STRINGS, parallelism);
+               }
+       }
+
+       @Test
+       public void testSetKeyNamespace() throws IOException {
+               for (int parallelism : TEST_PARALLELISMS) {
+                       testSetKeyNamespaceInternal(IntSerializer.INSTANCE, 
IntSerializer.INSTANCE, TEST_INTS, TEST_INTS, parallelism);
 
 Review comment:
   Maybe small improvement. 
   We could have tuple2's of Serializer and test collection.
   Also embedded loops to iterate over possible combinations of tuple2's for 
key/namespace/user key cases.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

Reply via email to