use of org.apache.carbondata.core.localdictionary.exception.DictionaryThresholdReachedException in project carbondata by apache.
the class TestLocalDictionaryGenerator method testColumnLocalDictionaryGeneratorWhenThresholdReached_ExceptionShouldBeThrown.
@Test
public void testColumnLocalDictionaryGeneratorWhenThresholdReached_ExceptionShouldBeThrown() {
LocalDictionaryGenerator generator = new ColumnLocalDictionaryGenerator(1000, 2);
try {
for (int i = 1; i <= 10000; i++) {
generator.generateDictionary(("" + i).getBytes());
}
Assert.assertTrue(false);
} catch (DictionaryThresholdReachedException e) {
Assert.assertTrue(true);
}
Assert.assertTrue(generator.isThresholdReached());
}
use of org.apache.carbondata.core.localdictionary.exception.DictionaryThresholdReachedException in project carbondata by apache.
the class TestDictionaryStore method testDictionaryStoreWithinThreshold.
@Test
public void testDictionaryStoreWithinThreshold() {
DictionaryStore dictionaryStore = new MapBasedDictionaryStore(10);
for (int i = 0; i < 10; i++) {
try {
dictionaryStore.putIfAbsent((i + "").getBytes());
Assert.assertTrue(true);
} catch (DictionaryThresholdReachedException e) {
Assert.assertTrue(false);
break;
}
}
}
Aggregations