Search in sources :

Example 1 with FileMergeCachingFileSystem

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;
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) FileSystem(org.apache.hadoop.fs.FileSystem) ExtendedFileSystem(com.facebook.presto.hive.filesystem.ExtendedFileSystem) ForCachingFileSystem(com.facebook.presto.cache.ForCachingFileSystem) FileMergeCachingFileSystem(com.facebook.presto.cache.filemerge.FileMergeCachingFileSystem) ExtendedFileSystem(com.facebook.presto.hive.filesystem.ExtendedFileSystem) PrestoException(com.facebook.presto.spi.PrestoException) FileMergeCachingFileSystem(com.facebook.presto.cache.filemerge.FileMergeCachingFileSystem) IOException(java.io.IOException)

Example 2 with FileMergeCachingFileSystem

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());
    }
}
Also used : AlluxioCachingFileSystem(com.facebook.presto.cache.alluxio.AlluxioCachingFileSystem) ExtendedFileSystem(com.facebook.presto.hive.filesystem.ExtendedFileSystem) FileMergeCachingFileSystem(com.facebook.presto.cache.filemerge.FileMergeCachingFileSystem)

Aggregations

FileMergeCachingFileSystem (com.facebook.presto.cache.filemerge.FileMergeCachingFileSystem)2 ExtendedFileSystem (com.facebook.presto.hive.filesystem.ExtendedFileSystem)2 ForCachingFileSystem (com.facebook.presto.cache.ForCachingFileSystem)1 AlluxioCachingFileSystem (com.facebook.presto.cache.alluxio.AlluxioCachingFileSystem)1 PrestoException (com.facebook.presto.spi.PrestoException)1 IOException (java.io.IOException)1 Configuration (org.apache.hadoop.conf.Configuration)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 Path (org.apache.hadoop.fs.Path)1