use of com.facebook.presto.cache.filemerge.FileMergeCachingFileSystem in project presto by prestodb.
the class RaptorCachingHdfsConfiguration method getConfiguration.
@Override
public Configuration getConfiguration(HdfsContext context, URI uri) {
@SuppressWarnings("resource") Configuration config = new CachingJobConf((factoryConfig, factoryUri) -> {
try {
FileSystem fileSystem = (new Path(factoryUri)).getFileSystem(hiveHdfsConfiguration.getConfiguration(context, factoryUri));
checkState(fileSystem instanceof ExtendedFileSystem);
return new FileMergeCachingFileSystem(factoryUri, factoryConfig, cacheManager, (ExtendedFileSystem) fileSystem, cacheValidationEnabled);
} catch (IOException e) {
throw new PrestoException(GENERIC_INTERNAL_ERROR, "cannot create caching FS", e);
}
});
Configuration defaultConfig = hiveHdfsConfiguration.getConfiguration(context, uri);
copy(defaultConfig, config);
return config;
}
use of com.facebook.presto.cache.filemerge.FileMergeCachingFileSystem in project presto by prestodb.
the class CacheFactory method createCachingFileSystem.
public ExtendedFileSystem createCachingFileSystem(Configuration factoryConfig, URI factoryUri, ExtendedFileSystem fileSystem, CacheManager cacheManager, boolean cachingEnabled, CacheType cacheType, boolean validationEnabled) throws IOException {
if (!cachingEnabled) {
return fileSystem;
}
checkState(cacheType != null);
switch(cacheType) {
case FILE_MERGE:
return new FileMergeCachingFileSystem(factoryUri, factoryConfig, cacheManager, fileSystem, validationEnabled);
case ALLUXIO:
ExtendedFileSystem cachingFileSystem = new AlluxioCachingFileSystem(fileSystem, factoryUri, validationEnabled);
cachingFileSystem.initialize(factoryUri, factoryConfig);
return cachingFileSystem;
default:
throw new IllegalArgumentException("Invalid CacheType: " + cacheType.name());
}
}
Aggregations