Search in sources :

Example 1 with AccumuloTableLayoutHandle

use of com.facebook.presto.accumulo.model.AccumuloTableLayoutHandle in project presto by prestodb.

the class AccumuloSplitManager method getSplits.

@Override
public ConnectorSplitSource getSplits(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorTableLayoutHandle layout) {
    AccumuloTableLayoutHandle layoutHandle = (AccumuloTableLayoutHandle) layout;
    AccumuloTableHandle tableHandle = layoutHandle.getTable();
    String schemaName = tableHandle.getSchema();
    String tableName = tableHandle.getTable();
    String rowIdName = tableHandle.getRowId();
    // Get non-row ID column constraints
    List<AccumuloColumnConstraint> constraints = getColumnConstraints(rowIdName, layoutHandle.getConstraint());
    // Get the row domain column range
    Optional<Domain> rDom = getRangeDomain(rowIdName, layoutHandle.getConstraint());
    // Call out to our client to retrieve all tablet split metadata using the row ID domain and the secondary index
    List<TabletSplitMetadata> tabletSplits = client.getTabletSplits(session, schemaName, tableName, rDom, constraints, tableHandle.getSerializerInstance());
    // Pack the tablet split metadata into a connector split
    ImmutableList.Builder<ConnectorSplit> cSplits = ImmutableList.builder();
    for (TabletSplitMetadata splitMetadata : tabletSplits) {
        AccumuloSplit split = new AccumuloSplit(connectorId, schemaName, tableName, rowIdName, tableHandle.getSerializerClassName(), splitMetadata.getRanges().stream().map(WrappedRange::new).collect(Collectors.toList()), constraints, tableHandle.getScanAuthorizations(), splitMetadata.getHostPort());
        cSplits.add(split);
    }
    return new FixedSplitSource(cSplits.build());
}
Also used : AccumuloColumnConstraint(com.facebook.presto.accumulo.model.AccumuloColumnConstraint) ImmutableList(com.google.common.collect.ImmutableList) TabletSplitMetadata(com.facebook.presto.accumulo.model.TabletSplitMetadata) AccumuloSplit(com.facebook.presto.accumulo.model.AccumuloSplit) WrappedRange(com.facebook.presto.accumulo.model.WrappedRange) AccumuloTableLayoutHandle(com.facebook.presto.accumulo.model.AccumuloTableLayoutHandle) FixedSplitSource(com.facebook.presto.spi.FixedSplitSource) AccumuloTableHandle(com.facebook.presto.accumulo.model.AccumuloTableHandle) ColumnDomain(com.facebook.presto.spi.predicate.TupleDomain.ColumnDomain) TupleDomain(com.facebook.presto.spi.predicate.TupleDomain) Domain(com.facebook.presto.spi.predicate.Domain) ConnectorSplit(com.facebook.presto.spi.ConnectorSplit)

Example 2 with AccumuloTableLayoutHandle

use of com.facebook.presto.accumulo.model.AccumuloTableLayoutHandle in project presto by prestodb.

the class AccumuloMetadata method getTableLayouts.

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

Example 3 with AccumuloTableLayoutHandle

use of com.facebook.presto.accumulo.model.AccumuloTableLayoutHandle in project presto by prestodb.

the class AccumuloSplitManager method getSplits.

@Override
public ConnectorSplitSource getSplits(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorTableLayoutHandle layout, SplitSchedulingContext splitSchedulingContext) {
    AccumuloTableLayoutHandle layoutHandle = (AccumuloTableLayoutHandle) layout;
    AccumuloTableHandle tableHandle = layoutHandle.getTable();
    String schemaName = tableHandle.getSchema();
    String tableName = tableHandle.getTable();
    String rowIdName = tableHandle.getRowId();
    // Get non-row ID column constraints
    List<AccumuloColumnConstraint> constraints = getColumnConstraints(rowIdName, layoutHandle.getConstraint());
    // Get the row domain column range
    Optional<Domain> rDom = getRangeDomain(rowIdName, layoutHandle.getConstraint());
    // Call out to our client to retrieve all tablet split metadata using the row ID domain and the secondary index
    List<TabletSplitMetadata> tabletSplits = client.getTabletSplits(session, schemaName, tableName, rDom, constraints, tableHandle.getSerializerInstance());
    // Pack the tablet split metadata into a connector split
    ImmutableList.Builder<ConnectorSplit> cSplits = ImmutableList.builder();
    for (TabletSplitMetadata splitMetadata : tabletSplits) {
        AccumuloSplit split = new AccumuloSplit(connectorId, schemaName, tableName, rowIdName, tableHandle.getSerializerClassName(), splitMetadata.getRanges().stream().map(WrappedRange::new).collect(Collectors.toList()), constraints, tableHandle.getScanAuthorizations(), splitMetadata.getHostPort());
        cSplits.add(split);
    }
    return new FixedSplitSource(cSplits.build());
}
Also used : AccumuloColumnConstraint(com.facebook.presto.accumulo.model.AccumuloColumnConstraint) ImmutableList(com.google.common.collect.ImmutableList) TabletSplitMetadata(com.facebook.presto.accumulo.model.TabletSplitMetadata) AccumuloSplit(com.facebook.presto.accumulo.model.AccumuloSplit) WrappedRange(com.facebook.presto.accumulo.model.WrappedRange) AccumuloTableLayoutHandle(com.facebook.presto.accumulo.model.AccumuloTableLayoutHandle) FixedSplitSource(com.facebook.presto.spi.FixedSplitSource) AccumuloTableHandle(com.facebook.presto.accumulo.model.AccumuloTableHandle) Domain(com.facebook.presto.common.predicate.Domain) TupleDomain(com.facebook.presto.common.predicate.TupleDomain) ColumnDomain(com.facebook.presto.common.predicate.TupleDomain.ColumnDomain) ConnectorSplit(com.facebook.presto.spi.ConnectorSplit)

Aggregations

AccumuloTableHandle (com.facebook.presto.accumulo.model.AccumuloTableHandle)3 AccumuloTableLayoutHandle (com.facebook.presto.accumulo.model.AccumuloTableLayoutHandle)3 AccumuloColumnConstraint (com.facebook.presto.accumulo.model.AccumuloColumnConstraint)2 AccumuloSplit (com.facebook.presto.accumulo.model.AccumuloSplit)2 TabletSplitMetadata (com.facebook.presto.accumulo.model.TabletSplitMetadata)2 WrappedRange (com.facebook.presto.accumulo.model.WrappedRange)2 ConnectorSplit (com.facebook.presto.spi.ConnectorSplit)2 FixedSplitSource (com.facebook.presto.spi.FixedSplitSource)2 ImmutableList (com.google.common.collect.ImmutableList)2 Domain (com.facebook.presto.common.predicate.Domain)1 TupleDomain (com.facebook.presto.common.predicate.TupleDomain)1 ColumnDomain (com.facebook.presto.common.predicate.TupleDomain.ColumnDomain)1 ConnectorTableLayout (com.facebook.presto.spi.ConnectorTableLayout)1 ConnectorTableLayoutResult (com.facebook.presto.spi.ConnectorTableLayoutResult)1 Domain (com.facebook.presto.spi.predicate.Domain)1 TupleDomain (com.facebook.presto.spi.predicate.TupleDomain)1 ColumnDomain (com.facebook.presto.spi.predicate.TupleDomain.ColumnDomain)1