Search in sources :

Example 1 with CounterStat

use of com.facebook.airlift.stats.CounterStat in project presto by prestodb.

the class PipelineContext method getInputDataSize.

public CounterStat getInputDataSize() {
    CounterStat stat = new CounterStat();
    stat.merge(rawInputDataSize);
    for (DriverContext driver : drivers) {
        stat.merge(driver.getInputDataSize());
    }
    return stat;
}
Also used : CounterStat(com.facebook.airlift.stats.CounterStat)

Example 2 with CounterStat

use of com.facebook.airlift.stats.CounterStat in project presto by prestodb.

the class PipelineContext method getOutputDataSize.

public CounterStat getOutputDataSize() {
    CounterStat stat = new CounterStat();
    stat.merge(outputDataSize);
    for (DriverContext driver : drivers) {
        stat.merge(driver.getOutputDataSize());
    }
    return stat;
}
Also used : CounterStat(com.facebook.airlift.stats.CounterStat)

Example 3 with CounterStat

use of com.facebook.airlift.stats.CounterStat in project presto by prestodb.

the class TestSqlTask method createInitialTask.

public SqlTask createInitialTask() {
    TaskId taskId = new TaskId("query", 0, 0, nextTaskId.incrementAndGet());
    URI location = URI.create("fake://task/" + taskId);
    QueryContext queryContext = new QueryContext(new QueryId("query"), new DataSize(1, MEGABYTE), new DataSize(2, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, GIGABYTE), new MemoryPool(new MemoryPoolId("test"), new DataSize(1, GIGABYTE)), new TestingGcMonitor(), taskNotificationExecutor, driverYieldExecutor, new DataSize(1, MEGABYTE), new SpillSpaceTracker(new DataSize(1, GIGABYTE)), listJsonCodec(TaskMemoryReservationSummary.class));
    queryContext.addTaskContext(new TaskStateMachine(taskId, taskNotificationExecutor), testSessionBuilder().build(), Optional.of(PLAN_FRAGMENT.getRoot()), false, false, false, false, false);
    return createSqlTask(taskId, location, "fake", queryContext, sqlTaskExecutionFactory, new MockExchangeClientSupplier(), taskNotificationExecutor, Functions.identity(), new DataSize(32, MEGABYTE), new CounterStat(), new SpoolingOutputBufferFactory(new FeaturesConfig()));
}
Also used : TaskMemoryReservationSummary(com.facebook.presto.operator.TaskMemoryReservationSummary) SpillSpaceTracker(com.facebook.presto.spiller.SpillSpaceTracker) MockExchangeClientSupplier(com.facebook.presto.execution.TestSqlTaskManager.MockExchangeClientSupplier) CounterStat(com.facebook.airlift.stats.CounterStat) FeaturesConfig(com.facebook.presto.sql.analyzer.FeaturesConfig) QueryId(com.facebook.presto.spi.QueryId) QueryContext(com.facebook.presto.memory.QueryContext) URI(java.net.URI) DataSize(io.airlift.units.DataSize) TestingGcMonitor(com.facebook.airlift.stats.TestingGcMonitor) SpoolingOutputBufferFactory(com.facebook.presto.execution.buffer.SpoolingOutputBufferFactory) MemoryPoolId(com.facebook.presto.spi.memory.MemoryPoolId) MemoryPool(com.facebook.presto.memory.MemoryPool)

Example 4 with CounterStat

use of com.facebook.airlift.stats.CounterStat in project presto by prestodb.

the class TestHiveSplitSource method testOutstandingSplitSize.

@Test
public void testOutstandingSplitSize() {
    DataSize maxOutstandingSplitsSize = new DataSize(1, MEGABYTE);
    HiveSplitSource hiveSplitSource = HiveSplitSource.allAtOnce(SESSION, "database", "table", new CacheQuotaRequirement(GLOBAL, Optional.empty()), 10, 10000, maxOutstandingSplitsSize, new TestingHiveSplitLoader(), EXECUTOR, new CounterStat());
    TestSplit testSplit = new TestSplit(0);
    int testSplitSizeInBytes = testSplit.getEstimatedSizeInBytes() + testSplit.getPartitionInfo().getEstimatedSizeInBytes();
    int maxSplitCount = toIntExact(maxOutstandingSplitsSize.toBytes()) / testSplitSizeInBytes;
    for (int i = 0; i < maxSplitCount; i++) {
        hiveSplitSource.addToQueue(new TestSplit(i));
        assertEquals(hiveSplitSource.getBufferedInternalSplitCount(), i + 1);
    }
    assertEquals(getSplits(hiveSplitSource, maxSplitCount).size(), maxSplitCount);
    for (int i = 0; i < maxSplitCount; i++) {
        hiveSplitSource.addToQueue(new TestSplit(i));
        assertEquals(hiveSplitSource.getBufferedInternalSplitCount(), i + 1);
    }
    try {
        hiveSplitSource.addToQueue(new TestSplit(0));
        fail("expect failure");
    } catch (PrestoException e) {
        assertContains(e.getMessage(), "Split buffering for database.table exceeded memory limit");
    }
}
Also used : CounterStat(com.facebook.airlift.stats.CounterStat) DataSize(io.airlift.units.DataSize) PrestoException(com.facebook.presto.spi.PrestoException) Test(org.testng.annotations.Test)

Example 5 with CounterStat

use of com.facebook.airlift.stats.CounterStat in project presto by prestodb.

the class TestHiveSplitSource method testSplitCacheQuota.

@Test
public void testSplitCacheQuota() {
    // CacheQuota: TABLE 1G for unbucked splits
    HiveSplitSource hiveSplitSource = HiveSplitSource.allAtOnce(SESSION, "database", "table", new CacheQuotaRequirement(TABLE, DEFAULT_QUOTA_SIZE), 10, 10, new DataSize(1, MEGABYTE), new TestingHiveSplitLoader(), EXECUTOR, new CounterStat());
    // add 10 splits
    for (int i = 0; i < 10; i++) {
        hiveSplitSource.addToQueue(new TestSplit(i));
        assertEquals(hiveSplitSource.getBufferedInternalSplitCount(), i + 1);
    }
    HiveSplit hiveSplit = (HiveSplit) getSplits(hiveSplitSource, 1).get(0);
    CacheQuotaRequirement cacheQuotaRequirement = new CacheQuotaRequirement(TABLE, DEFAULT_QUOTA_SIZE);
    assertEquals(hiveSplit.getCacheQuotaRequirement().getQuota(), cacheQuotaRequirement.getQuota());
    assertEquals(hiveSplit.getCacheQuotaRequirement().getCacheQuotaScope(), cacheQuotaRequirement.getCacheQuotaScope());
    // CacheQuota: PARTITION Optional.empty() for bucketed splits
    hiveSplitSource = HiveSplitSource.bucketed(SESSION, "database", "table", new CacheQuotaRequirement(PARTITION, Optional.empty()), 10, 10, new DataSize(1, MEGABYTE), new TestingHiveSplitLoader(), EXECUTOR, new CounterStat());
    // add 10 splits
    for (int i = 0; i < 10; i++) {
        hiveSplitSource.addToQueue(new TestSplit(i, OptionalInt.of(2)));
        assertEquals(hiveSplitSource.getBufferedInternalSplitCount(), i + 1);
    }
    hiveSplit = (HiveSplit) getSplits(hiveSplitSource, OptionalInt.of(2), 1).get(0);
    cacheQuotaRequirement = new CacheQuotaRequirement(PARTITION, Optional.empty());
    assertEquals(hiveSplit.getCacheQuotaRequirement().getQuota(), cacheQuotaRequirement.getQuota());
    assertEquals(hiveSplit.getCacheQuotaRequirement().getCacheQuotaScope(), cacheQuotaRequirement.getCacheQuotaScope());
}
Also used : CounterStat(com.facebook.airlift.stats.CounterStat) DataSize(io.airlift.units.DataSize) Test(org.testng.annotations.Test)

Aggregations

CounterStat (com.facebook.airlift.stats.CounterStat)20 DataSize (io.airlift.units.DataSize)12 Test (org.testng.annotations.Test)10 CacheConfig (com.facebook.presto.cache.CacheConfig)3 NoHdfsAuthentication (com.facebook.presto.hive.authentication.NoHdfsAuthentication)3 OutputStreamDataSinkFactory (com.facebook.presto.hive.datasink.OutputStreamDataSinkFactory)3 SchemaTableName (com.facebook.presto.spi.SchemaTableName)3 FeaturesConfig (com.facebook.presto.sql.analyzer.FeaturesConfig)3 GroupByHashPageIndexerFactory (com.facebook.presto.GroupByHashPageIndexerFactory)2 MockExchangeClientSupplier (com.facebook.presto.execution.TestSqlTaskManager.MockExchangeClientSupplier)2 SpoolingOutputBufferFactory (com.facebook.presto.execution.buffer.SpoolingOutputBufferFactory)2 QueryContext (com.facebook.presto.memory.QueryContext)2 ConnectorSplit (com.facebook.presto.spi.ConnectorSplit)2 PrestoException (com.facebook.presto.spi.PrestoException)2 TestingNodeManager (com.facebook.presto.testing.TestingNodeManager)2 URI (java.net.URI)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 BoundedExecutor (com.facebook.airlift.concurrent.BoundedExecutor)1 TestingGcMonitor (com.facebook.airlift.stats.TestingGcMonitor)1 Subfield (com.facebook.presto.common.Subfield)1