Search in sources :

Example 1 with PathService

use of org.apache.carbondata.core.service.PathService in project carbondata by apache.

the class CarbonDictionarySortIndexReaderImpl method initPath.

protected void initPath() {
    PathService pathService = CarbonCommonFactory.getPathService();
    CarbonTablePath carbonTablePath = pathService.getCarbonTablePath(carbonStorePath, carbonTableIdentifier);
    try {
        CarbonDictionaryColumnMetaChunk chunkMetaObjectForLastSegmentEntry = getChunkMetaObjectForLastSegmentEntry();
        long dictOffset = chunkMetaObjectForLastSegmentEntry.getEnd_offset();
        this.sortIndexFilePath = carbonTablePath.getSortIndexFilePath(columnIdentifier.getColumnId(), dictOffset);
        if (!FileFactory.isFileExist(this.sortIndexFilePath, FileFactory.getFileType(this.sortIndexFilePath))) {
            this.sortIndexFilePath = carbonTablePath.getSortIndexFilePath(columnIdentifier.getColumnId());
        }
    } catch (IOException e) {
        this.sortIndexFilePath = carbonTablePath.getSortIndexFilePath(columnIdentifier.getColumnId());
    }
}
Also used : PathService(org.apache.carbondata.core.service.PathService) CarbonTablePath(org.apache.carbondata.core.util.path.CarbonTablePath) CarbonDictionaryColumnMetaChunk(org.apache.carbondata.core.reader.CarbonDictionaryColumnMetaChunk) IOException(java.io.IOException)

Example 2 with PathService

use of org.apache.carbondata.core.service.PathService in project carbondata by apache.

the class CarbonDictionaryReaderImpl method initFileLocation.

/**
   * This method will form the path for dictionary file for a given column
   */
protected void initFileLocation() {
    PathService pathService = CarbonCommonFactory.getPathService();
    CarbonTablePath carbonTablePath = pathService.getCarbonTablePath(this.storePath, carbonTableIdentifier);
    this.columnDictionaryFilePath = carbonTablePath.getDictionaryFilePath(columnIdentifier.getColumnId());
}
Also used : PathService(org.apache.carbondata.core.service.PathService) CarbonTablePath(org.apache.carbondata.core.util.path.CarbonTablePath)

Example 3 with PathService

use of org.apache.carbondata.core.service.PathService in project carbondata by apache.

the class CarbonDictionaryWriterImpl method initPaths.

protected void initPaths() {
    PathService pathService = CarbonCommonFactory.getPathService();
    CarbonTablePath carbonTablePath = pathService.getCarbonTablePath(this.storePath, carbonTableIdentifier);
    this.dictionaryFilePath = carbonTablePath.getDictionaryFilePath(columnIdentifier.getColumnId());
    this.dictionaryMetaFilePath = carbonTablePath.getDictionaryMetaFilePath(columnIdentifier.getColumnId());
}
Also used : PathService(org.apache.carbondata.core.service.PathService) CarbonTablePath(org.apache.carbondata.core.util.path.CarbonTablePath)

Example 4 with PathService

use of org.apache.carbondata.core.service.PathService in project carbondata by apache.

the class CarbonDictionarySortIndexWriterImpl method initPath.

protected void initPath() {
    PathService pathService = CarbonCommonFactory.getPathService();
    CarbonTablePath carbonTablePath = pathService.getCarbonTablePath(carbonStorePath, carbonTableIdentifier);
    String dictionaryPath = carbonTablePath.getDictionaryFilePath(columnIdentifier.getColumnId());
    long dictOffset = CarbonUtil.getFileSize(dictionaryPath);
    this.sortIndexFilePath = carbonTablePath.getSortIndexFilePath(columnIdentifier.getColumnId(), dictOffset);
    cleanUpOldSortIndex(carbonTablePath, dictionaryPath);
}
Also used : PathService(org.apache.carbondata.core.service.PathService) CarbonTablePath(org.apache.carbondata.core.util.path.CarbonTablePath)

Example 5 with PathService

use of org.apache.carbondata.core.service.PathService in project carbondata by apache.

the class CarbonUtil method isFileExistsForGivenColumn.

/**
   * This method will check if dictionary and its metadata file exists for a given column
   *
   * @param dictionaryColumnUniqueIdentifier unique identifier which contains dbName,
   *                                         tableName and columnIdentifier
   * @return
   */
public static boolean isFileExistsForGivenColumn(String carbonStorePath, DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier) {
    PathService pathService = CarbonCommonFactory.getPathService();
    CarbonTablePath carbonTablePath = pathService.getCarbonTablePath(carbonStorePath, dictionaryColumnUniqueIdentifier.getCarbonTableIdentifier());
    String dictionaryFilePath = carbonTablePath.getDictionaryFilePath(dictionaryColumnUniqueIdentifier.getColumnIdentifier().getColumnId());
    String dictionaryMetadataFilePath = carbonTablePath.getDictionaryMetaFilePath(dictionaryColumnUniqueIdentifier.getColumnIdentifier().getColumnId());
    // check if both dictionary and its metadata file exists for a given column
    return isFileExists(dictionaryFilePath) && isFileExists(dictionaryMetadataFilePath);
}
Also used : PathService(org.apache.carbondata.core.service.PathService) CarbonTablePath(org.apache.carbondata.core.util.path.CarbonTablePath)

Aggregations

PathService (org.apache.carbondata.core.service.PathService)7 CarbonTablePath (org.apache.carbondata.core.util.path.CarbonTablePath)7 IOException (java.io.IOException)2 CarbonFile (org.apache.carbondata.core.datastore.filesystem.CarbonFile)1 FileFactory (org.apache.carbondata.core.datastore.impl.FileFactory)1 CarbonDictionaryColumnMetaChunk (org.apache.carbondata.core.reader.CarbonDictionaryColumnMetaChunk)1