Skip to content

Commit 731433c

Browse files
jackylkQiangCai
authored andcommitted
[CARBONATA-3605] Remove global dictionary feature
This closes apache#3502
1 parent 7374a89 commit 731433c

File tree

314 files changed

+681
-29516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

314 files changed

+681
-29516
lines changed

conf/carbon.properties.template

-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ carbon.major.compaction.size=1024
8585
##Min max feature is added to enhance query performance. To disable this feature, make it false.
8686
#carbon.enableMinMax=true
8787

88-
######## Global Dictionary Configurations ########
8988
##The property to set the date to be considered as start date for calculating the timestamp.
9089
#carbon.cutOffTimestamp
9190
##The property to set the timestamp (ie milis) conversion to the SECOND, MINUTE, HOUR or DAY level.

conf/dataload.properties.template

+1-7
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ delimiter=,
3535
#csv comment character
3636
#commentchar=#
3737

38-
#column dictionary list
39-
#columndict=
40-
41-
#null value's serialization format
38+
#null value's serialization format
4239
#serialization_null_format=\\N
4340

4441
#bad records logger
@@ -47,9 +44,6 @@ delimiter=,
4744
#bad records action
4845
#bad_records_action=force
4946

50-
#all dictionary folder path
51-
#all_dictionary_path=
52-
5347
#complex column's level 1 delimiter
5448
#complex_delimiter_level_1='\\\001'
5549

core/src/main/java/org/apache/carbondata/core/cache/CacheProvider.java

+11-26
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
import java.util.Map;
2323

2424
import org.apache.carbondata.common.logging.LogServiceFactory;
25-
import org.apache.carbondata.core.cache.dictionary.Dictionary;
26-
import org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier;
27-
import org.apache.carbondata.core.cache.dictionary.ForwardDictionaryCache;
28-
import org.apache.carbondata.core.cache.dictionary.ReverseDictionaryCache;
2925
import org.apache.carbondata.core.constants.CarbonCommonConstants;
3026
import org.apache.carbondata.core.indexstore.BlockletDataMapIndexStore;
3127
import org.apache.carbondata.core.util.CarbonProperties;
@@ -89,13 +85,13 @@ public static CacheProvider getInstance() {
8985
public <K, V> Cache<K, V> createCache(CacheType cacheType) {
9086
//check if lru cache is null, if null create one
9187
//check if cache is null for given cache type, if null create one
92-
if (!dictionaryCacheAlreadyExists(cacheType)) {
88+
if (!isCacheExists(cacheType)) {
9389
synchronized (lock) {
94-
if (!dictionaryCacheAlreadyExists(cacheType)) {
90+
if (!isCacheExists(cacheType)) {
9591
if (null == carbonLRUCache) {
9692
createLRULevelCacheInstance();
9793
}
98-
createDictionaryCacheForGivenType(cacheType);
94+
createBlockletDataMapCache(cacheType);
9995
}
10096
}
10197
}
@@ -110,9 +106,9 @@ public <K, V> Cache<K, V> createCache(CacheType cacheType, String cacheClassName
110106
throws Exception {
111107
//check if lru cache is null, if null create one
112108
//check if cache is null for given cache type, if null create one
113-
if (!dictionaryCacheAlreadyExists(cacheType)) {
109+
if (!isCacheExists(cacheType)) {
114110
synchronized (lock) {
115-
if (!dictionaryCacheAlreadyExists(cacheType)) {
111+
if (!isCacheExists(cacheType)) {
116112
if (null == carbonLRUCache) {
117113
createLRULevelCacheInstance();
118114
}
@@ -132,14 +128,14 @@ public <K, V> Cache<K, V> createCache(CacheType cacheType, String cacheClassName
132128
*
133129
* @param cacheType type of cache
134130
*/
135-
private void createDictionaryCacheForGivenType(CacheType cacheType) {
131+
private void createBlockletDataMapCache(CacheType cacheType) {
136132
Cache cacheObject = null;
137133
if (cacheType.equals(CacheType.REVERSE_DICTIONARY)) {
138-
cacheObject =
139-
new ReverseDictionaryCache<DictionaryColumnUniqueIdentifier, Dictionary>(carbonLRUCache);
134+
// TODO: remove cache for dictionary after dictionary id deprecated
135+
return;
140136
} else if (cacheType.equals(CacheType.FORWARD_DICTIONARY)) {
141-
cacheObject =
142-
new ForwardDictionaryCache<DictionaryColumnUniqueIdentifier, Dictionary>(carbonLRUCache);
137+
// TODO: remove cache for dictionary after dictionary id deprecated
138+
return;
143139
} else if (cacheType.equals(cacheType.DRIVER_BLOCKLET_DATAMAP)) {
144140
cacheObject = new BlockletDataMapIndexStore(carbonLRUCache);
145141
}
@@ -181,21 +177,10 @@ private void createLRULevelCacheInstance() {
181177
* @param cacheType
182178
* @return
183179
*/
184-
private boolean dictionaryCacheAlreadyExists(CacheType cacheType) {
180+
private boolean isCacheExists(CacheType cacheType) {
185181
return null != cacheTypeToCacheMap.get(cacheType);
186182
}
187183

188-
/**
189-
* Below method will be used to clear the cache
190-
*/
191-
public void dropAllCache() {
192-
if (null != carbonLRUCache) {
193-
carbonLRUCache.clear();
194-
carbonLRUCache = null;
195-
}
196-
cacheTypeToCacheMap.clear();
197-
}
198-
199184
public CarbonLRUCache getCarbonCache() {
200185
return carbonLRUCache;
201186
}

core/src/main/java/org/apache/carbondata/core/cache/dictionary/AbstractColumnDictionaryInfo.java

-128
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
package org.apache.carbondata.core.cache.dictionary;
1919

20-
import java.nio.charset.Charset;
2120
import java.util.List;
2221
import java.util.concurrent.CopyOnWriteArrayList;
2322
import java.util.concurrent.atomic.AtomicInteger;
@@ -50,21 +49,11 @@ public abstract class AbstractColumnDictionaryInfo implements DictionaryInfo {
5049
*/
5150
protected long fileTimeStamp;
5251

53-
/**
54-
* offset till where file is read
55-
*/
56-
protected long offsetTillFileIsRead;
57-
5852
/**
5953
* memory size of this object.We store it as calculation everytime is costly
6054
*/
6155
protected long memorySize;
6256

63-
/**
64-
* length of dictionary metadata file
65-
*/
66-
private long dictionaryMetaFileLength;
67-
6857
/**
6958
* size of one dictionary bucket
7059
*/
@@ -102,31 +91,6 @@ public long getMemorySize() {
10291
return memorySize;
10392
}
10493

105-
@Override
106-
public void setMemorySize(long memorySize) {
107-
this.memorySize = memorySize;
108-
}
109-
110-
/**
111-
* This method will increment the access count for a column by 1
112-
* whenever a column is getting used in query or incremental data load
113-
*/
114-
@Override
115-
public void incrementAccessCount() {
116-
accessCount.incrementAndGet();
117-
}
118-
119-
/**
120-
* This method will return the size of of last dictionary chunk so that only that many
121-
* values are read from the dictionary reader
122-
*
123-
* @return size of last dictionary chunk
124-
*/
125-
@Override
126-
public int getSizeOfLastDictionaryChunk() {
127-
return 0;
128-
}
129-
13094
/**
13195
* This method will decrement the access count for a column by 1
13296
* whenever a column usage is complete
@@ -137,32 +101,6 @@ private void decrementAccessCount() {
137101
}
138102
}
139103

140-
/**
141-
* This method will update the end offset of file everytime a file is read
142-
*
143-
* @param offsetTillFileIsRead
144-
*/
145-
@Override
146-
public void setOffsetTillFileIsRead(long offsetTillFileIsRead) {
147-
this.offsetTillFileIsRead = offsetTillFileIsRead;
148-
}
149-
150-
@Override
151-
public long getOffsetTillFileIsRead() {
152-
return offsetTillFileIsRead;
153-
}
154-
155-
/**
156-
* This method will update the timestamp of a file if a file is modified
157-
* like in case of incremental load
158-
*
159-
* @param fileTimeStamp
160-
*/
161-
@Override
162-
public void setFileTimeStamp(long fileTimeStamp) {
163-
this.fileTimeStamp = fileTimeStamp;
164-
}
165-
166104
/**
167105
* The method return the list of dictionary chunks of a column
168106
* Applications Scenario.
@@ -183,56 +121,6 @@ public void clear() {
183121
decrementAccessCount();
184122
}
185123

186-
/**
187-
* This method will find and return the sort index for a given dictionary id.
188-
* Applicable scenarios:
189-
* 1. Used in case of order by queries when data sorting is required
190-
*
191-
* @param surrogateKey a unique ID for a dictionary value
192-
* @return if found returns key else 0
193-
*/
194-
@Override
195-
public int getSortedIndex(int surrogateKey) {
196-
return 0;
197-
}
198-
199-
/**
200-
* dictionary metadata file length which will be set whenever we reload dictionary
201-
* data from disk
202-
*
203-
* @param dictionaryMetaFileLength length of dictionary metadata file
204-
*/
205-
@Override
206-
public void setDictionaryMetaFileLength(long dictionaryMetaFileLength) {
207-
this.dictionaryMetaFileLength = dictionaryMetaFileLength;
208-
}
209-
210-
/**
211-
* Dictionary meta file offset which will be read to check whether length of dictionary
212-
* meta file has been modified
213-
*
214-
* @return
215-
*/
216-
@Override
217-
public long getDictionaryMetaFileLength() {
218-
return dictionaryMetaFileLength;
219-
}
220-
221-
/**
222-
* This method will find and return the dictionary value from sorted index.
223-
* Applicable scenarios:
224-
* 1. Query final result preparation in case of order by queries:
225-
* While convert the final result which will
226-
* be surrogate key back to original dictionary values this method will be used
227-
*
228-
* @param sortedIndex sort index of dictionary value
229-
* @return value if found else null
230-
*/
231-
@Override
232-
public String getDictionaryValueFromSortedIndex(int sortedIndex) {
233-
return null;
234-
}
235-
236124
/**
237125
* This method will find and return the dictionary value for a given surrogate key.
238126
* Applicable scenarios:
@@ -299,22 +187,6 @@ protected byte[] getDictionaryBytesFromSurrogate(int surrogateKey) {
299187
return dictionaryValueInBytes;
300188
}
301189

302-
/**
303-
* This method will find and return the surrogate key for a given dictionary value
304-
* Applicable scenario:
305-
* 1. Incremental data load : Dictionary will not be generated for existing values. For
306-
* that values have to be looked up in the existing dictionary cache.
307-
* 2. Filter scenarios where from value surrogate key has to be found.
308-
*
309-
* @param value dictionary value
310-
* @return if found returns key else INVALID_SURROGATE_KEY
311-
*/
312-
@Override
313-
public int getSurrogateKey(String value) {
314-
byte[] keyData = value.getBytes(Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET));
315-
return getSurrogateKey(keyData);
316-
}
317-
318190
@Override
319191
public void invalidate() {
320192

0 commit comments

Comments
 (0)