Search in sources :

Example 1 with CarbonDictionaryMetadataReader

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;
}
Also used : DictionaryService(org.apache.carbondata.core.service.DictionaryService) CarbonDictionaryColumnMetaChunk(org.apache.carbondata.core.reader.CarbonDictionaryColumnMetaChunk) CarbonDictionaryMetadataReader(org.apache.carbondata.core.reader.CarbonDictionaryMetadataReader)

Example 2 with CarbonDictionaryMetadataReader

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();
}
Also used : DictionaryService(org.apache.carbondata.core.service.DictionaryService) CarbonDictionaryColumnMetaChunk(org.apache.carbondata.core.reader.CarbonDictionaryColumnMetaChunk) CarbonDictionaryMetadataReader(org.apache.carbondata.core.reader.CarbonDictionaryMetadataReader)

Example 3 with CarbonDictionaryMetadataReader

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;
}
Also used : CarbonDictionaryColumnMetaChunk(org.apache.carbondata.core.reader.CarbonDictionaryColumnMetaChunk) CarbonDictionaryMetadataReader(org.apache.carbondata.core.reader.CarbonDictionaryMetadataReader)

Aggregations

CarbonDictionaryColumnMetaChunk (org.apache.carbondata.core.reader.CarbonDictionaryColumnMetaChunk)3 CarbonDictionaryMetadataReader (org.apache.carbondata.core.reader.CarbonDictionaryMetadataReader)3 DictionaryService (org.apache.carbondata.core.service.DictionaryService)2