Search in sources :

Example 6 with PathService

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

the class CarbonDictionaryMetadataReaderImpl method initFileLocation.

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

Example 7 with PathService

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

the class AbstractDictionaryCache method getDictionaryMetaCarbonFile.

/**
   * This method will return the carbon file objetc based on its type (local, HDFS)
   *
   * @param dictionaryColumnUniqueIdentifier
   * @return
   */
private CarbonFile getDictionaryMetaCarbonFile(DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier) throws IOException {
    PathService pathService = CarbonCommonFactory.getPathService();
    CarbonTablePath carbonTablePath = pathService.getCarbonTablePath(carbonStorePath, dictionaryColumnUniqueIdentifier.getCarbonTableIdentifier());
    String dictionaryFilePath = carbonTablePath.getDictionaryMetaFilePath(dictionaryColumnUniqueIdentifier.getColumnIdentifier().getColumnId());
    FileFactory.FileType fileType = FileFactory.getFileType(dictionaryFilePath);
    CarbonFile dictFile = FileFactory.getCarbonFile(dictionaryFilePath, fileType);
    // When rename table triggered parallely with select query, dictionary files may not exist
    if (!dictFile.exists()) {
        throw new IOException("Dictionary file does not exist: " + dictionaryFilePath);
    }
    return dictFile;
}
Also used : CarbonFile(org.apache.carbondata.core.datastore.filesystem.CarbonFile) PathService(org.apache.carbondata.core.service.PathService) CarbonTablePath(org.apache.carbondata.core.util.path.CarbonTablePath) IOException(java.io.IOException) FileFactory(org.apache.carbondata.core.datastore.impl.FileFactory)

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