You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "clintropolis (via GitHub)" <gi...@apache.org> on 2023/03/28 03:14:33 UTC

[GitHub] [druid] clintropolis commented on a diff in pull request #13988: add backwards compat mode for frontCoded stringEncodingStrategy

clintropolis commented on code in PR #13988:
URL: https://github.com/apache/druid/pull/13988#discussion_r1149980320


##########
processing/src/test/java/org/apache/druid/segment/column/StringEncodingStrategyTest.java:
##########
@@ -0,0 +1,68 @@
+/*
+ * 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.druid.segment.column;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import nl.jqno.equalsverifier.EqualsVerifier;
+import org.apache.druid.jackson.DefaultObjectMapper;
+import org.apache.druid.segment.data.FrontCodedIndexed;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class StringEncodingStrategyTest
+{
+  private static final ObjectMapper JSON_MAPPER = new DefaultObjectMapper();
+
+
+  @Test
+  public void testUtf8Serde() throws JsonProcessingException
+  {
+    StringEncodingStrategy utf8 = new StringEncodingStrategy.Utf8();
+    String there = JSON_MAPPER.writeValueAsString(utf8);
+    StringEncodingStrategy andBackAgain = JSON_MAPPER.readValue(there, StringEncodingStrategy.class);
+    Assert.assertEquals(utf8, andBackAgain);
+  }
+
+  @Test
+  public void testFrontCodedDefaultSerde() throws JsonProcessingException
+  {
+    StringEncodingStrategy frontCoded = new StringEncodingStrategy.FrontCoded(null, null);
+    String there = JSON_MAPPER.writeValueAsString(frontCoded);
+    StringEncodingStrategy andBackAgain = JSON_MAPPER.readValue(there, StringEncodingStrategy.class);
+    Assert.assertEquals(frontCoded, andBackAgain);
+  }

Review Comment:
   added `FrontCodedIndexed.DEFAULT_VERSION` (and also moved `DEFAULT_BUCKET_SIZE` here), and test for both of them as well as explicit test for v1



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org