Search in sources :

Example 21 with CacheConfig

use of com.facebook.presto.cache.CacheConfig in project presto by prestodb.

the class TestHivePartitionManager method testIgnoresBucketingWhenTooManyBuckets.

@Test
public void testIgnoresBucketingWhenTooManyBuckets() {
    ConnectorSession session = new TestingConnectorSession(new HiveSessionProperties(new HiveClientConfig().setMaxBucketsForGroupedExecution(100), new OrcFileWriterConfig(), new ParquetFileWriterConfig(), new CacheConfig()).getSessionProperties());
    HivePartitionResult result = hivePartitionManager.getPartitions(metastore, new HiveTableHandle(SCHEMA_NAME, TABLE_NAME), Constraint.alwaysTrue(), session);
    assertFalse(result.getBucketHandle().isPresent(), "bucketHandle is present");
    assertFalse(result.getBucketFilter().isPresent(), "bucketFilter is present");
}
Also used : TestingConnectorSession(com.facebook.presto.testing.TestingConnectorSession) TestingConnectorSession(com.facebook.presto.testing.TestingConnectorSession) ConnectorSession(com.facebook.presto.spi.ConnectorSession) CacheConfig(com.facebook.presto.cache.CacheConfig) Test(org.testng.annotations.Test)

Example 22 with CacheConfig

use of com.facebook.presto.cache.CacheConfig in project presto by prestodb.

the class TestAlluxioCachingFileSystem method testStress.

@Test(invocationCount = 10)
public void testStress() throws ExecutionException, InterruptedException, URISyntaxException, IOException {
    CacheConfig cacheConfig = new CacheConfig().setCacheType(ALLUXIO).setCachingEnabled(true).setBaseDirectory(cacheDirectory);
    AlluxioCacheConfig alluxioCacheConfig = new AlluxioCacheConfig().setMaxCacheSize(new DataSize(10, KILOBYTE));
    Configuration configuration = getHdfsConfiguration(cacheConfig, alluxioCacheConfig);
    AlluxioCachingFileSystem cachingFileSystem = cachingFileSystem(configuration);
    stressTest(data, (position, buffer, offset, length) -> {
        try {
            readFully(cachingFileSystem, position, buffer, offset, length);
        } catch (Exception e) {
            e.printStackTrace();
        }
    });
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) DataSize(io.airlift.units.DataSize) CacheConfig(com.facebook.presto.cache.CacheConfig) NotImplementedException(alluxio.shaded.client.org.apache.commons.lang3.NotImplementedException) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) Test(org.testng.annotations.Test) TestingCacheUtils.stressTest(com.facebook.presto.cache.TestingCacheUtils.stressTest)

Example 23 with CacheConfig

use of com.facebook.presto.cache.CacheConfig in project presto by prestodb.

the class TestFileMergeCacheManager method testStress.

@Test(invocationCount = 10)
public void testStress() throws ExecutionException, InterruptedException {
    CacheConfig cacheConfig = new CacheConfig().setBaseDirectory(cacheDirectory);
    FileMergeCacheConfig fileMergeCacheConfig = new FileMergeCacheConfig().setCacheTtl(new Duration(10, MILLISECONDS));
    CacheManager cacheManager = fileMergeCacheManager(cacheConfig, fileMergeCacheConfig);
    stressTest(data, (position, buffer, offset, length) -> readFully(cacheManager, NO_CACHE_CONSTRAINTS, position, buffer, offset, length));
}
Also used : CacheManager(com.facebook.presto.cache.CacheManager) Duration(io.airlift.units.Duration) CacheConfig(com.facebook.presto.cache.CacheConfig) Test(org.testng.annotations.Test) TestingCacheUtils.stressTest(com.facebook.presto.cache.TestingCacheUtils.stressTest)

Example 24 with CacheConfig

use of com.facebook.presto.cache.CacheConfig in project presto by prestodb.

the class TestFileMergeCacheManager method fileMergeCacheManager.

private CacheManager fileMergeCacheManager(CacheStats cacheStats) {
    CacheConfig cacheConfig = new CacheConfig();
    FileMergeCacheConfig fileMergeCacheConfig = new FileMergeCacheConfig();
    return new FileMergeCacheManager(cacheConfig.setBaseDirectory(cacheDirectory), fileMergeCacheConfig, cacheStats, flushExecutor, removeExecutor, cacheSizeCalculator);
}
Also used : CacheConfig(com.facebook.presto.cache.CacheConfig)

Example 25 with CacheConfig

use of com.facebook.presto.cache.CacheConfig in project presto by prestodb.

the class TestAlluxioCachingFileSystem method testStressWithQuota.

@Test(invocationCount = 10)
public void testStressWithQuota() throws ExecutionException, InterruptedException, URISyntaxException, IOException {
    CacheQuota cacheQuota = new CacheQuota("test.table", Optional.of(DataSize.succinctDataSize(5, KILOBYTE)));
    CacheConfig cacheConfig = new CacheConfig().setCacheType(ALLUXIO).setCachingEnabled(true).setValidationEnabled(false).setBaseDirectory(cacheDirectory).setCacheQuotaScope(TABLE);
    AlluxioCacheConfig alluxioCacheConfig = new AlluxioCacheConfig().setMaxCacheSize(new DataSize(10, KILOBYTE)).setCacheQuotaEnabled(true);
    Configuration configuration = getHdfsConfiguration(cacheConfig, alluxioCacheConfig);
    AlluxioCachingFileSystem cachingFileSystem = cachingFileSystem(configuration);
    stressTest(data, (position, buffer, offset, length) -> {
        try {
            readFully(cachingFileSystem, cacheQuota, position, buffer, offset, length);
        } catch (Exception e) {
            e.printStackTrace();
        }
    });
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) DataSize(io.airlift.units.DataSize) CacheConfig(com.facebook.presto.cache.CacheConfig) CacheQuota(com.facebook.presto.hive.CacheQuota) NotImplementedException(alluxio.shaded.client.org.apache.commons.lang3.NotImplementedException) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) Test(org.testng.annotations.Test) TestingCacheUtils.stressTest(com.facebook.presto.cache.TestingCacheUtils.stressTest)

Aggregations

CacheConfig (com.facebook.presto.cache.CacheConfig)45 Test (org.testng.annotations.Test)33 TestingConnectorSession (com.facebook.presto.testing.TestingConnectorSession)31 ConnectorSession (com.facebook.presto.spi.ConnectorSession)18 Configuration (org.apache.hadoop.conf.Configuration)12 SchemaTableName (com.facebook.presto.spi.SchemaTableName)9 ConnectorPageSource (com.facebook.presto.spi.ConnectorPageSource)8 HiveClientConfig (com.facebook.presto.hive.HiveClientConfig)7 HiveSessionProperties (com.facebook.presto.hive.HiveSessionProperties)7 OrcFileWriterConfig (com.facebook.presto.hive.OrcFileWriterConfig)7 ParquetFileWriterConfig (com.facebook.presto.hive.ParquetFileWriterConfig)7 TestingCacheUtils.stressTest (com.facebook.presto.cache.TestingCacheUtils.stressTest)6 Storage (com.facebook.presto.hive.metastore.Storage)6 File (java.io.File)6 StorageFormat (com.facebook.presto.hive.metastore.StorageFormat)5 OutputStreamDataSinkFactory (com.facebook.presto.hive.datasink.OutputStreamDataSinkFactory)4 RcFilePageSourceFactory (com.facebook.presto.hive.rcfile.RcFilePageSourceFactory)4 DataSize (io.airlift.units.DataSize)4 BeforeClass (org.testng.annotations.BeforeClass)4 CounterStat (com.facebook.airlift.stats.CounterStat)3