Search in sources :

Example 26 with ConnectorTableLayoutResult

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

the class TestRaptorSplitManager method testNoHostForShard.

@Test(expectedExceptions = PrestoException.class, expectedExceptionsMessageRegExp = "No host for shard .* found: \\[\\]")
public void testNoHostForShard() throws InterruptedException {
    deleteShardNodes();
    ConnectorTableLayoutResult layout = getOnlyElement(metadata.getTableLayouts(SESSION, tableHandle, Constraint.alwaysTrue(), Optional.empty()));
    ConnectorSplitSource splitSource = getSplits(raptorSplitManager, layout);
    getFutureValue(splitSource.getNextBatch(1000));
}
Also used : ConnectorTableLayoutResult(com.facebook.presto.spi.ConnectorTableLayoutResult) ConnectorSplitSource(com.facebook.presto.spi.ConnectorSplitSource) Test(org.testng.annotations.Test)

Example 27 with ConnectorTableLayoutResult

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

the class ExampleMetadata method getTableLayouts.

@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) {
    ExampleTableHandle tableHandle = (ExampleTableHandle) table;
    ConnectorTableLayout layout = new ConnectorTableLayout(new ExampleTableLayoutHandle(tableHandle));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
Also used : ConnectorTableLayoutResult(com.facebook.presto.spi.ConnectorTableLayoutResult) ConnectorTableLayout(com.facebook.presto.spi.ConnectorTableLayout)

Example 28 with ConnectorTableLayoutResult

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

the class MongoMetadata method getTableLayouts.

@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) {
    MongoTableHandle tableHandle = (MongoTableHandle) table;
    //TODO: sharding key
    Optional<Set<ColumnHandle>> partitioningColumns = Optional.empty();
    ImmutableList.Builder<LocalProperty<ColumnHandle>> localProperties = ImmutableList.builder();
    MongoTable tableInfo = mongoSession.getTable(tableHandle.getSchemaTableName());
    Map<String, ColumnHandle> columns = getColumnHandles(session, tableHandle);
    for (MongoIndex index : tableInfo.getIndexes()) {
        for (MongodbIndexKey key : index.getKeys()) {
            if (!key.getSortOrder().isPresent()) {
                continue;
            }
            if (columns.get(key.getName()) != null) {
                localProperties.add(new SortingProperty<>(columns.get(key.getName()), key.getSortOrder().get()));
            }
        }
    }
    ConnectorTableLayout layout = new ConnectorTableLayout(new MongoTableLayoutHandle(tableHandle, constraint.getSummary()), Optional.empty(), TupleDomain.all(), Optional.empty(), partitioningColumns, Optional.empty(), localProperties.build());
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
Also used : ColumnHandle(com.facebook.presto.spi.ColumnHandle) Set(java.util.Set) ImmutableList(com.google.common.collect.ImmutableList) ConnectorTableLayoutResult(com.facebook.presto.spi.ConnectorTableLayoutResult) MongodbIndexKey(com.facebook.presto.mongodb.MongoIndex.MongodbIndexKey) ConnectorTableLayout(com.facebook.presto.spi.ConnectorTableLayout) LocalProperty(com.facebook.presto.spi.LocalProperty)

Example 29 with ConnectorTableLayoutResult

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

the class RaptorMetadata method getTableLayouts.

@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) {
    RaptorTableHandle handle = (RaptorTableHandle) table;
    ConnectorTableLayout layout = getTableLayout(session, handle, constraint.getSummary());
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
Also used : ConnectorTableLayoutResult(com.facebook.presto.spi.ConnectorTableLayoutResult) ConnectorTableLayout(com.facebook.presto.spi.ConnectorTableLayout)

Example 30 with ConnectorTableLayoutResult

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

the class SystemTablesMetadata method getTableLayouts.

@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) {
    SystemTableHandle tableHandle = (SystemTableHandle) table;
    ConnectorTableLayout layout = new ConnectorTableLayout(new SystemTableLayoutHandle(tableHandle.getConnectorId(), tableHandle, constraint.getSummary()));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
Also used : ConnectorTableLayoutResult(com.facebook.presto.spi.ConnectorTableLayoutResult) ConnectorTableLayout(com.facebook.presto.spi.ConnectorTableLayout)

Aggregations

ConnectorTableLayoutResult (com.facebook.presto.spi.ConnectorTableLayoutResult)38 ConnectorTableLayout (com.facebook.presto.spi.ConnectorTableLayout)28 ColumnHandle (com.facebook.presto.spi.ColumnHandle)20 Test (org.testng.annotations.Test)19 ConnectorSplitSource (com.facebook.presto.spi.ConnectorSplitSource)18 Constraint (com.facebook.presto.spi.Constraint)18 ConnectorTableHandle (com.facebook.presto.spi.ConnectorTableHandle)17 ConnectorTableMetadata (com.facebook.presto.spi.ConnectorTableMetadata)17 Map (java.util.Map)17 ColumnMetadata (com.facebook.presto.spi.ColumnMetadata)16 ConnectorOutputTableHandle (com.facebook.presto.spi.ConnectorOutputTableHandle)16 ConnectorSession (com.facebook.presto.spi.ConnectorSession)16 ConnectorSplit (com.facebook.presto.spi.ConnectorSplit)16 SchemaTableName (com.facebook.presto.spi.SchemaTableName)16 TupleDomain (com.facebook.presto.spi.predicate.TupleDomain)16 ImmutableList (com.google.common.collect.ImmutableList)16 ImmutableMap (com.google.common.collect.ImmutableMap)16 Set (java.util.Set)16 ConnectorMetadata (com.facebook.presto.spi.connector.ConnectorMetadata)15 GroupByHashPageIndexerFactory (com.facebook.presto.GroupByHashPageIndexerFactory)14