Search in sources :

Example 1 with ConnectorTableLayout

use of io.prestosql.spi.connector.ConnectorTableLayout in project hetu-core by openlookeng.

the class TpcdsMetadata method getTableLayouts.

@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint constraint, Optional<Set<ColumnHandle>> desiredColumns) {
    TpcdsTableHandle tableHandle = (TpcdsTableHandle) table;
    ConnectorTableLayout layout = new ConnectorTableLayout(new TpcdsTableLayoutHandle(tableHandle), Optional.empty(), TupleDomain.all(), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableList.of());
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
Also used : ConnectorTableLayoutResult(io.prestosql.spi.connector.ConnectorTableLayoutResult) ConnectorTableLayout(io.prestosql.spi.connector.ConnectorTableLayout)

Example 2 with ConnectorTableLayout

use of io.prestosql.spi.connector.ConnectorTableLayout in project hetu-core by openlookeng.

the class MetadataManager method getLayout.

@Override
public Optional<TableLayoutResult> getLayout(Session session, TableHandle table, Constraint constraint, Optional<Set<ColumnHandle>> desiredColumns) {
    if (constraint.getSummary().isNone()) {
        return Optional.empty();
    }
    CatalogName catalogName = table.getCatalogName();
    ConnectorTableHandle connectorTable = table.getConnectorHandle();
    CatalogMetadata catalogMetadata = getCatalogMetadata(session, catalogName);
    ConnectorMetadata metadata = catalogMetadata.getMetadataFor(catalogName);
    checkState(metadata.usesLegacyTableLayouts(), "getLayout() was called even though connector doesn't support legacy Table Layout");
    ConnectorTransactionHandle transaction = catalogMetadata.getTransactionHandleFor(catalogName);
    ConnectorSession connectorSession = session.toConnectorSession(catalogName);
    List<ConnectorTableLayoutResult> layouts = metadata.getTableLayouts(connectorSession, connectorTable, constraint, desiredColumns);
    if (layouts.isEmpty()) {
        return Optional.empty();
    }
    if (layouts.size() > 1) {
        throw new PrestoException(NOT_SUPPORTED, format("Connector returned multiple layouts for table %s", table));
    }
    ConnectorTableLayout tableLayout = layouts.get(0).getTableLayout();
    return Optional.of(new TableLayoutResult(new TableHandle(catalogName, connectorTable, transaction, Optional.of(tableLayout.getHandle())), new TableProperties(catalogName, transaction, new ConnectorTableProperties(tableLayout)), layouts.get(0).getUnenforcedConstraint()));
}
Also used : ConnectorTransactionHandle(io.prestosql.spi.connector.ConnectorTransactionHandle) PrestoException(io.prestosql.spi.PrestoException) ConnectorTableLayoutResult(io.prestosql.spi.connector.ConnectorTableLayoutResult) ConnectorTableHandle(io.prestosql.spi.connector.ConnectorTableHandle) ConnectorTableLayoutResult(io.prestosql.spi.connector.ConnectorTableLayoutResult) ConnectorTableLayout(io.prestosql.spi.connector.ConnectorTableLayout) CatalogName(io.prestosql.spi.connector.CatalogName) ConnectorSession(io.prestosql.spi.connector.ConnectorSession) ConnectorVacuumTableHandle(io.prestosql.spi.connector.ConnectorVacuumTableHandle) ConnectorDeleteAsInsertTableHandle(io.prestosql.spi.connector.ConnectorDeleteAsInsertTableHandle) ConnectorUpdateTableHandle(io.prestosql.spi.connector.ConnectorUpdateTableHandle) ConnectorOutputTableHandle(io.prestosql.spi.connector.ConnectorOutputTableHandle) TableHandle(io.prestosql.spi.metadata.TableHandle) ConnectorTableHandle(io.prestosql.spi.connector.ConnectorTableHandle) ConnectorInsertTableHandle(io.prestosql.spi.connector.ConnectorInsertTableHandle) ConnectorMetadata(io.prestosql.spi.connector.ConnectorMetadata) ConnectorTableProperties(io.prestosql.spi.connector.ConnectorTableProperties) ConnectorTableProperties(io.prestosql.spi.connector.ConnectorTableProperties)

Example 3 with ConnectorTableLayout

use of io.prestosql.spi.connector.ConnectorTableLayout in project incubator-pulsar by apache.

the class PulsarMetadata method getTableLayouts.

@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint constraint, Optional<Set<ColumnHandle>> desiredColumns) {
    PulsarTableHandle handle = convertTableHandle(table);
    ConnectorTableLayout layout = new ConnectorTableLayout(new PulsarTableLayoutHandle(handle, constraint.getSummary()));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
Also used : ConnectorTableLayoutResult(io.prestosql.spi.connector.ConnectorTableLayoutResult) ConnectorTableLayout(io.prestosql.spi.connector.ConnectorTableLayout)

Example 4 with ConnectorTableLayout

use of io.prestosql.spi.connector.ConnectorTableLayout in project pulsar by yahoo.

the class PulsarMetadata method getTableLayouts.

@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint constraint, Optional<Set<ColumnHandle>> desiredColumns) {
    PulsarTableHandle handle = convertTableHandle(table);
    ConnectorTableLayout layout = new ConnectorTableLayout(new PulsarTableLayoutHandle(handle, constraint.getSummary()));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
Also used : ConnectorTableLayoutResult(io.prestosql.spi.connector.ConnectorTableLayoutResult) ConnectorTableLayout(io.prestosql.spi.connector.ConnectorTableLayout)

Example 5 with ConnectorTableLayout

use of io.prestosql.spi.connector.ConnectorTableLayout in project pulsar by apache.

the class PulsarMetadata method getTableLayouts.

@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint constraint, Optional<Set<ColumnHandle>> desiredColumns) {
    PulsarTableHandle handle = convertTableHandle(table);
    ConnectorTableLayout layout = new ConnectorTableLayout(new PulsarTableLayoutHandle(handle, constraint.getSummary()));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
Also used : ConnectorTableLayoutResult(io.prestosql.spi.connector.ConnectorTableLayoutResult) ConnectorTableLayout(io.prestosql.spi.connector.ConnectorTableLayout)

Aggregations

ConnectorTableLayout (io.prestosql.spi.connector.ConnectorTableLayout)6 ConnectorTableLayoutResult (io.prestosql.spi.connector.ConnectorTableLayoutResult)6 PrestoException (io.prestosql.spi.PrestoException)1 CatalogName (io.prestosql.spi.connector.CatalogName)1 ConnectorDeleteAsInsertTableHandle (io.prestosql.spi.connector.ConnectorDeleteAsInsertTableHandle)1 ConnectorInsertTableHandle (io.prestosql.spi.connector.ConnectorInsertTableHandle)1 ConnectorMetadata (io.prestosql.spi.connector.ConnectorMetadata)1 ConnectorOutputTableHandle (io.prestosql.spi.connector.ConnectorOutputTableHandle)1 ConnectorSession (io.prestosql.spi.connector.ConnectorSession)1 ConnectorTableHandle (io.prestosql.spi.connector.ConnectorTableHandle)1 ConnectorTableProperties (io.prestosql.spi.connector.ConnectorTableProperties)1 ConnectorTransactionHandle (io.prestosql.spi.connector.ConnectorTransactionHandle)1 ConnectorUpdateTableHandle (io.prestosql.spi.connector.ConnectorUpdateTableHandle)1 ConnectorVacuumTableHandle (io.prestosql.spi.connector.ConnectorVacuumTableHandle)1 TableHandle (io.prestosql.spi.metadata.TableHandle)1