Java 类com.facebook.presto.spi.ConnectorTableLayout 实例源码

项目:paraflow    文件:HDFSMetadata.java   
/**
 * Return a list of table layouts that satisfy the given constraint.
 * <p>
 * For each layout, connectors must return an "unenforced constraint" representing the part of the constraint summary that isn't guaranteed by the layout.
 *
 * @param session session
 * @param table table
 * @param constraint constraint
 * @param desiredColumns desired columns
 */
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
    // get table name from ConnectorTableHandle
    HDFSTableHandle hdfsTable = checkType(table, HDFSTableHandle.class, "table");
    SchemaTableName tableName = hdfsTable.getSchemaTableName();
    // create HDFSTableLayoutHandle
    HDFSTableLayoutHandle tableLayout = metaDataQuery.getTableLayout(connectorId, tableName.getSchemaName(), tableName.getTableName()).orElse(null);
    tableLayout.setPredicates(constraint.getSummary() != null ? Optional.of(constraint.getSummary()) : Optional.empty());
    // ConnectorTableLayout layout = new ConnectorTableLayout(HDFSTableLayoutHandle)
    ConnectorTableLayout layout = getTableLayout(session, tableLayout);

    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
项目:paraflow    文件:HDFSMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    // TODO add fiber and timestamp as new LocalProperty into ConnectorTableLayout ?
    HDFSTableLayoutHandle layoutHandle = checkType(handle, HDFSTableLayoutHandle.class, "tableLayoutHandle");
    return new ConnectorTableLayout(layoutHandle);
}
项目:presto-rest    文件:RestMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession connectorSession, ConnectorTableLayoutHandle connectorTableLayoutHandle)
{

    RestConnectorTableLayoutHandle tableLayoutHandle = Types.checkType(connectorTableLayoutHandle, RestConnectorTableLayoutHandle.class, "tableLayoutHandle");
    return new ConnectorTableLayout(tableLayoutHandle);
}
项目:presto-kudu    文件:KuduMetadata.java   
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
    KuduTableHandle tableHandle = checkType(table, KuduTableHandle.class, "tableHandle");
    ConnectorTableLayout layout = new ConnectorTableLayout(new KuduTableLayoutHandle(tableHandle, constraint.getSummary()));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
项目:presto    文件:KafkaMetadata.java   
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
    KafkaTableHandle handle = convertTableHandle(table);
    ConnectorTableLayout layout = new ConnectorTableLayout(new KafkaTableLayoutHandle(handle));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
项目:presto    文件:ExampleMetadata.java   
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
    ExampleTableHandle tableHandle = checkType(table, ExampleTableHandle.class, "table");
    ConnectorTableLayout layout = new ConnectorTableLayout(new ExampleTableLayoutHandle(tableHandle));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
项目:presto    文件:RaptorMetadata.java   
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
    RaptorTableHandle handle = checkType(table, RaptorTableHandle.class, "table");
    ConnectorTableLayout layout = new ConnectorTableLayout(new RaptorTableLayoutHandle(handle, constraint.getSummary()));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
项目:presto    文件:RedisMetadata.java   
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(
        ConnectorSession session,
        ConnectorTableHandle table,
        Constraint<ColumnHandle> constraint,
        Optional<Set<ColumnHandle>> desiredColumns)
{
    RedisTableHandle tableHandle = convertTableHandle(table);

    ConnectorTableLayout layout = new ConnectorTableLayout(new RedisTableLayoutHandle(tableHandle));

    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
项目:presto    文件:RedisMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    RedisTableLayoutHandle layout = convertLayout(handle);

    // tables in this connector have a single layout
    return getTableLayouts(session, layout.getTable(), Constraint.<ColumnHandle>alwaysTrue(), Optional.empty())
            .get(0)
            .getTableLayout();
}
项目:presto    文件:BlackHoleMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    return new ConnectorTableLayout(
            handle,
            Optional.empty(),
            TupleDomain.none(),
            Optional.empty(),
            Optional.empty(),
            ImmutableList.of());
}
项目:presto    文件:JmxMetadata.java   
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
    JmxTableHandle handle = checkType(table, JmxTableHandle.class, "table");
    ConnectorTableLayout layout = new ConnectorTableLayout(new JmxTableLayoutHandle(handle, constraint.getSummary()));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
项目:presto    文件:JdbcMetadata.java   
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
    JdbcTableHandle tableHandle = checkType(table, JdbcTableHandle.class, "table");
    ConnectorTableLayout layout = new ConnectorTableLayout(new JdbcTableLayoutHandle(tableHandle, constraint.getSummary()));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
项目:presto    文件:InformationSchemaMetadata.java   
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
    InformationSchemaTableHandle handle = checkType(table, InformationSchemaTableHandle.class, "table");
    ConnectorTableLayout layout = new ConnectorTableLayout(new InformationSchemaTableLayoutHandle(handle, constraint.getSummary()));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
项目:presto    文件:SystemTablesMetadata.java   
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
    SystemTableHandle tableHandle = checkType(table, SystemTableHandle.class, "table");
    ConnectorTableLayout layout = new ConnectorTableLayout(new SystemTableLayoutHandle(tableHandle.getConnectorId(), tableHandle, constraint.getSummary()));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
项目:presto    文件:TableLayout.java   
public TableLayout(TableLayoutHandle handle, ConnectorTableLayout layout)
{
    requireNonNull(handle, "handle is null");
    requireNonNull(layout, "layout is null");

    this.handle = handle;
    this.layout = layout;
}
项目:presto    文件:TpchMetadata.java   
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session,
        ConnectorTableHandle table,
        Constraint<ColumnHandle> constraint,
        Optional<Set<ColumnHandle>> desiredColumns)
{
    TpchTableHandle tableHandle = checkType(table, TpchTableHandle.class, "table");

    Optional<Set<ColumnHandle>> partitioningColumns = Optional.empty();
    List<LocalProperty<ColumnHandle>> localProperties = ImmutableList.of();

    Map<String, ColumnHandle> columns = getColumnHandles(session, tableHandle);
    if (tableHandle.getTableName().equals(TpchTable.ORDERS.getTableName())) {
        partitioningColumns = Optional.of(ImmutableSet.of(columns.get(OrderColumn.ORDER_KEY.getColumnName())));
        localProperties = ImmutableList.of(new SortingProperty<>(columns.get(OrderColumn.ORDER_KEY.getColumnName()), SortOrder.ASC_NULLS_FIRST));
    }
    else if (tableHandle.getTableName().equals(TpchTable.LINE_ITEM.getTableName())) {
        partitioningColumns = Optional.of(ImmutableSet.of(columns.get(LineItemColumn.ORDER_KEY.getColumnName())));
        localProperties = ImmutableList.of(
                new SortingProperty<>(columns.get(LineItemColumn.ORDER_KEY.getColumnName()), SortOrder.ASC_NULLS_FIRST),
                new SortingProperty<>(columns.get(LineItemColumn.LINE_NUMBER.getColumnName()), SortOrder.ASC_NULLS_FIRST));
    }

    ConnectorTableLayout layout = new ConnectorTableLayout(
            new TpchTableLayoutHandle(tableHandle),
            Optional.<List<ColumnHandle>>empty(),
            TupleDomain.<ColumnHandle>all(), // TODO: return well-known properties (e.g., orderkey > 0, etc)
            partitioningColumns,
            Optional.empty(),
            localProperties);

    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
项目:presto    文件:TpchMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    TpchTableLayoutHandle layout = checkType(handle, TpchTableLayoutHandle.class, "layout");

    // tables in this connector have a single layout
    return getTableLayouts(session, layout.getTable(), Constraint.<ColumnHandle>alwaysTrue(), Optional.empty())
            .get(0)
            .getTableLayout();
}
项目:presto    文件:ClassLoaderSafeConnectorMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
        return delegate.getTableLayout(session, handle);
    }
}
项目:presto    文件:CassandraMetadata.java   
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
    CassandraTableHandle handle = checkType(table, CassandraTableHandle.class, "table");
    CassandraPartitionResult result = partitionManager.getPartitions(handle, constraint.getSummary());
    ConnectorTableLayout layout = getTableLayout(session, new CassandraTableLayoutHandle(handle, result.getPartitions()));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, result.getUnenforcedConstraint()));
}
项目:presto    文件:HiveMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle layoutHandle)
{
    HiveTableLayoutHandle hiveLayoutHandle = checkType(layoutHandle, HiveTableLayoutHandle.class, "layoutHandle");
    List<TupleDomain<ColumnHandle>> partitionDomains = hiveLayoutHandle.getPartitions().get().stream()
            .map(HivePartition::getTupleDomain)
            .collect(toList());

    TupleDomain<ColumnHandle> predicate = TupleDomain.none();
    if (!partitionDomains.isEmpty()) {
        predicate = TupleDomain.columnWiseUnion(partitionDomains);
    }
    return new ConnectorTableLayout(hiveLayoutHandle, Optional.empty(), predicate, Optional.empty(), Optional.of(partitionDomains), ImmutableList.of());
}
项目:presto    文件:AbstractTestHiveClient.java   
protected void assertExpectedTableLayout(ConnectorTableLayout actualTableLayout, ConnectorTableLayout expectedTableLayout)
{
    assertExpectedTableLayoutHandle(actualTableLayout.getHandle(), expectedTableLayout.getHandle());
    assertEquals(actualTableLayout.getPredicate(), expectedTableLayout.getPredicate());
    assertEquals(actualTableLayout.getDiscretePredicates().isPresent(), expectedTableLayout.getDiscretePredicates().isPresent());
    actualTableLayout.getDiscretePredicates().ifPresent(actual -> assertEqualsIgnoreOrder(actual, expectedTableLayout.getDiscretePredicates().get()));
    assertEquals(actualTableLayout.getPartitioningColumns(), expectedTableLayout.getPartitioningColumns());
    assertEquals(actualTableLayout.getLocalProperties(), expectedTableLayout.getLocalProperties());
}
项目:presto-plugins    文件:SpreadsheetMetadata.java   
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table,
    Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) {
  SpreadsheetTableHandle tableHandle = (SpreadsheetTableHandle) table;
  SpreadsheetTableLayoutHandle baseTableLayoutHandle = createTableLayoutHandle(tableHandle);
  ConnectorTableLayout layout = new ConnectorTableLayout(baseTableLayoutHandle);
  return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
项目:presto-plugins    文件:SpreadsheetMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle) {
  SpreadsheetTableLayoutHandle layout = (SpreadsheetTableLayoutHandle) handle;
  List<ConnectorTableLayoutResult> tableLayouts = getTableLayouts(session, layout.getTable(),
      Constraint.<ColumnHandle>alwaysTrue(), Optional.empty());
  ConnectorTableLayoutResult connectorTableLayoutResult = tableLayouts.get(0);
  return connectorTableLayoutResult.getTableLayout();
}
项目:presto-plugins    文件:BaseReadOnlyConnectorMetadata.java   
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table,
    Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) {
  BaseTableHandle tableHandle = (BaseTableHandle) table;
  BaseTableLayoutHandle baseTableLayoutHandle = createTableLayoutHandle(tableHandle);
  ConnectorTableLayout layout = new ConnectorTableLayout(baseTableLayoutHandle);
  return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
项目:presto-plugins    文件:BaseReadOnlyConnectorMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle) {
  BaseTableLayoutHandle layout = (BaseTableLayoutHandle) handle;
  List<ConnectorTableLayoutResult> tableLayouts = getTableLayouts(session, layout.getTable(),
      Constraint.<ColumnHandle>alwaysTrue(), Optional.empty());
  ConnectorTableLayoutResult connectorTableLayoutResult = tableLayouts.get(0);
  return connectorTableLayoutResult.getTableLayout();
}
项目:presto-kinesis    文件:KinesisMetadata.java   
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession connectorSession, ConnectorTableHandle table,
                                                        Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> optional)
{
    KinesisTableHandle tblHandle = handleResolver.convertTableHandle(table);
    ConnectorTableLayout layout = new ConnectorTableLayout(new KinesisTableLayoutHandle(connectorId, tblHandle));
    return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
 }
项目:presto-ethereum    文件:EthereumMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle) {
    return new ConnectorTableLayout(handle);
}
项目:presto-kudu    文件:KuduMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    KuduTableLayoutHandle layout = checkType(handle, KuduTableLayoutHandle.class, "layout");
    return new ConnectorTableLayout(layout);
}
项目:presto    文件:KafkaMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    return new ConnectorTableLayout(handle);
}
项目:presto    文件:ExampleMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    return new ConnectorTableLayout(handle);
}
项目:presto    文件:RaptorMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    return new ConnectorTableLayout(handle);
}
项目:presto    文件:JmxMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    return new ConnectorTableLayout(handle);
}
项目:presto    文件:JdbcMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    return new ConnectorTableLayout(handle);
}
项目:presto    文件:LegacyConnectorMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    return metadata.getTableLayout(session, handle);
}
项目:presto    文件:InformationSchemaMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    return new ConnectorTableLayout(handle);
}
项目:presto    文件:SystemTablesMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    return new ConnectorTableLayout(handle);
}
项目:presto    文件:TableLayout.java   
public static TableLayout fromConnectorLayout(String connectorId, ConnectorTransactionHandle transactionHandle, ConnectorTableLayout layout)
{
    return new TableLayout(new TableLayoutHandle(connectorId, transactionHandle, layout.getHandle()), layout);
}
项目:presto    文件:CassandraMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    return new ConnectorTableLayout(handle);
}
项目:presto-kinesis    文件:KinesisMetadata.java   
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession connectorSession, ConnectorTableLayoutHandle connectorTableLayoutHandle)
{
    return new ConnectorTableLayout(connectorTableLayoutHandle);
}
项目:presto    文件:ConnectorMetadata.java   
ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle);