use of org.apache.carbondata.core.reader.CarbonDictionaryMetadataReader in project carbondata by apache.
the class AbstractDictionaryCache method readLastChunkFromDictionaryMetadataFile.
/**
* This method will read dictionary metadata file and return the dictionary meta chunks
*
* @param dictionaryColumnUniqueIdentifier
* @return list of dictionary metadata chunks
* @throws IOException read and close method throws IO exception
*/
protected CarbonDictionaryColumnMetaChunk readLastChunkFromDictionaryMetadataFile(DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier) throws IOException {
DictionaryService dictService = CarbonCommonFactory.getDictionaryService();
CarbonDictionaryMetadataReader columnMetadataReaderImpl = dictService.getDictionaryMetadataReader(dictionaryColumnUniqueIdentifier);
CarbonDictionaryColumnMetaChunk carbonDictionaryColumnMetaChunk = null;
// read metadata file
try {
carbonDictionaryColumnMetaChunk = columnMetadataReaderImpl.readLastEntryOfDictionaryMetaChunk();
} finally {
// close the metadata reader
columnMetadataReaderImpl.close();
}
return carbonDictionaryColumnMetaChunk;
}
use of org.apache.carbondata.core.reader.CarbonDictionaryMetadataReader in project carbondata by apache.
the class AbstractDictionaryCache method getNumRecordsInCarbonDictionaryColumnMetaChunk.
/**
* get the dictionary column meta chunk for object already read and stored in LRU cache
* @param dictionaryColumnUniqueIdentifier
* @param offsetRead
* @return
* @throws IOException
*/
protected long getNumRecordsInCarbonDictionaryColumnMetaChunk(DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier, long offsetRead) throws IOException {
DictionaryService dictService = CarbonCommonFactory.getDictionaryService();
CarbonDictionaryMetadataReader columnMetadataReaderImpl = dictService.getDictionaryMetadataReader(dictionaryColumnUniqueIdentifier);
CarbonDictionaryColumnMetaChunk carbonDictionaryColumnMetaChunk = null;
// read metadata file
try {
carbonDictionaryColumnMetaChunk = columnMetadataReaderImpl.readEntryOfDictionaryMetaChunk(offsetRead);
} finally {
// close the metadata reader
columnMetadataReaderImpl.close();
}
return carbonDictionaryColumnMetaChunk.getMax_surrogate_key();
}
use of org.apache.carbondata.core.reader.CarbonDictionaryMetadataReader in project carbondata by apache.
the class CarbonDictionaryWriterImpl method getChunkMetaObjectForLastSegmentEntry.
/**
* This method will read the dictionary chunk metadata thrift object for last entry
*
* @return last entry of dictionary meta chunk
* @throws IOException if an I/O error occurs
*/
private CarbonDictionaryColumnMetaChunk getChunkMetaObjectForLastSegmentEntry() throws IOException {
CarbonDictionaryColumnMetaChunk carbonDictionaryColumnMetaChunk = null;
CarbonDictionaryMetadataReader columnMetadataReaderImpl = getDictionaryMetadataReader();
try {
// read the last segment entry for dictionary metadata
carbonDictionaryColumnMetaChunk = columnMetadataReaderImpl.readLastEntryOfDictionaryMetaChunk();
} finally {
// Close metadata reader
columnMetadataReaderImpl.close();
}
return carbonDictionaryColumnMetaChunk;
}
Aggregations