You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by xx...@apache.org on 2020/11/24 03:24:03 UTC
[kylin] 02/02: FIX KYLIN-4810, Add some tips and test case
This is an automated email from the ASF dual-hosted git repository.
xxyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git
commit 3e12b6d621fe8e5c747a5783f64bc535618c8035
Author: zhengshengjun <zh...@youzan.com>
AuthorDate: Wed Nov 11 16:52:03 2020 +0800
FIX KYLIN-4810, Add some tips and test case
---
.../org/apache/kylin/dict/TrieDictionaryTest.java | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/core-dictionary/src/test/java/org/apache/kylin/dict/TrieDictionaryTest.java b/core-dictionary/src/test/java/org/apache/kylin/dict/TrieDictionaryTest.java
index 62f4de4..a39b302 100644
--- a/core-dictionary/src/test/java/org/apache/kylin/dict/TrieDictionaryTest.java
+++ b/core-dictionary/src/test/java/org/apache/kylin/dict/TrieDictionaryTest.java
@@ -170,6 +170,26 @@ public class TrieDictionaryTest {
}
@Test
+ public void utf8PartOverflowTest() {
+ //construct values more than 255 bytes
+ StringBuilder sb = new StringBuilder();
+ for (int i=0; i<255; i++){
+ sb.append('a');
+ }
+ // append utf-8 words, each word is more than 1 byte
+ sb.append("你好");
+ TrieDictionaryBuilder<String> b = new TrieDictionaryBuilder<String>(new StringBytesConverter());
+ b.addValue(sb.toString());
+ TrieDictionary<String> dict = b.build(0);
+ int totalValues = 0;
+ for (int i = dict.getMinId(); i <= dict.getMaxId(); i++) {
+ totalValues ++;
+ }
+ assertEquals(1, totalValues);
+ assertEquals(sb.toString(), dict.getValueFromId(0));
+ }
+
+ @Test
public void emptyValueTest() {
ArrayList<String> str = new ArrayList<String>();
str.add("");