Search in sources :

Example 11 with SplitContext

use of com.facebook.presto.spi.SplitContext in project presto by prestodb.

the class TestDynamicPruning method testDynamicPartitionPruning.

@Test
public void testDynamicPartitionPruning() {
    HiveClientConfig config = new HiveClientConfig();
    MetastoreClientConfig metastoreClientConfig = new MetastoreClientConfig();
    HiveTransactionHandle transaction = new HiveTransactionHandle();
    try (TempFile tempFile = new TempFile()) {
        ConnectorPageSource emptyPageSource = createTestingPageSource(transaction, config, new SplitContext(false, getToSkipTupleDomain()), metastoreClientConfig, tempFile.file());
        assertEquals(emptyPageSource.getClass(), HiveEmptySplitPageSource.class);
        ConnectorPageSource nonEmptyPageSource = createTestingPageSource(transaction, config, new SplitContext(false, getToKeepTupleDomain()), metastoreClientConfig, tempFile.file());
        assertEquals(nonEmptyPageSource.getClass(), HivePageSource.class);
    } catch (IOException e) {
        e.printStackTrace();
        fail();
    }
}
Also used : TempFile(com.facebook.airlift.testing.TempFile) SplitContext(com.facebook.presto.spi.SplitContext) IOException(java.io.IOException) ConnectorPageSource(com.facebook.presto.spi.ConnectorPageSource) Test(org.testng.annotations.Test)

Aggregations

SplitContext (com.facebook.presto.spi.SplitContext)11 ConnectorPageSource (com.facebook.presto.spi.ConnectorPageSource)7 ColumnHandle (com.facebook.presto.spi.ColumnHandle)6 ConnectorSession (com.facebook.presto.spi.ConnectorSession)6 PrestoException (com.facebook.presto.spi.PrestoException)6 TupleDomain (com.facebook.presto.common.predicate.TupleDomain)5 Type (com.facebook.presto.common.type.Type)5 ConnectorSplit (com.facebook.presto.spi.ConnectorSplit)5 ConnectorPageSourceProvider (com.facebook.presto.spi.connector.ConnectorPageSourceProvider)5 ConnectorTransactionHandle (com.facebook.presto.spi.connector.ConnectorTransactionHandle)5 List (java.util.List)5 Map (java.util.Map)5 Objects.requireNonNull (java.util.Objects.requireNonNull)5 Optional (java.util.Optional)5 Inject (javax.inject.Inject)5 Domain (com.facebook.presto.common.predicate.Domain)4 TypeManager (com.facebook.presto.common.type.TypeManager)4 Split (com.facebook.presto.metadata.Split)4 Subfield (com.facebook.presto.common.Subfield)3 HdfsContext (com.facebook.presto.hive.HdfsContext)3