com.facebook.presto.spi.ConnectorTableLayoutHandle Java Examples

The following examples show how to use com.facebook.presto.spi.ConnectorTableLayoutHandle. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KinesisSplitManager.java    From presto-kinesis with Apache License 2.0 6 votes vote down vote up
@Override
public ConnectorSplitSource getSplits(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorTableLayoutHandle layout, ConnectorSplitManager.SplitSchedulingStrategy splitSchedulingStrategy)
{
    KinesisTableLayoutHandle kinesislayout = handleResolver.convertLayout(layout);
    KinesisTableHandle kinesisTableHandle = kinesislayout.getTable();

    InternalStreamDescription desc = this.getStreamDescription(kinesisTableHandle.getStreamName());

    ImmutableList.Builder<ConnectorSplit> builder = ImmutableList.builder();
    for (Shard shard : desc.getShards()) {
        KinesisSplit split = new KinesisSplit(connectorId,
                kinesisTableHandle.getStreamName(),
                kinesisTableHandle.getMessageDataFormat(),
                shard.getShardId(),
                shard.getSequenceNumberRange().getStartingSequenceNumber(),
                shard.getSequenceNumberRange().getEndingSequenceNumber());
        builder.add(split);
    }

    return new FixedSplitSource(builder.build());
}
 
Example #2
Source File: KinesisHandleResolver.java    From presto-kinesis with Apache License 2.0 5 votes vote down vote up
KinesisTableLayoutHandle convertLayout(ConnectorTableLayoutHandle layout)
{
    requireNonNull(layout, "layout is null");
    checkArgument(layout instanceof KinesisTableLayoutHandle, "layout is not an instance of KinesisTableLayoutHandle");
    KinesisTableLayoutHandle kinesisLayout = (KinesisTableLayoutHandle) layout;
    checkArgument(kinesisLayout.getConnectorId().equals(connectorId), "split is not for this connector");
    return kinesisLayout;
}
 
Example #3
Source File: HbaseSplitManager.java    From presto-connectors with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectorSplitSource getSplits(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorTableLayoutHandle layout, SplitSchedulingStrategy splitSchedulingStrategy)
{
    HbaseTableLayoutHandle layoutHandle = (HbaseTableLayoutHandle) layout;
    HbaseTableHandle tableHandle = layoutHandle.getTable();

    String schemaName = tableHandle.getSchema();
    String tableName = tableHandle.getTable();
    String rowIdName = tableHandle.getRowId();

    // Get non-row ID column constraints
    List<HbaseColumnConstraint> 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) {
        HbaseSplit split = new HbaseSplit(
                connectorId,
                schemaName,
                tableName,
                rowIdName,
                splitMetadata,
                constraints,
                tableHandle.getScanAuthorizations());
        cSplits.add(split);
    }

    return new FixedSplitSource(cSplits.build());
}
 
Example #4
Source File: ElasticsearchSplitManager.java    From presto-connectors with Apache License 2.0 5 votes vote down vote up
@Override
    public ConnectorSplitSource getSplits(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorTableLayoutHandle layout, SplitSchedulingContext splitSchedulingContext )
    {
        SplitSchedulingStrategy splitSchedulingStrategy = splitSchedulingContext.getSplitSchedulingStrategy();
        ElasticsearchTableLayoutHandle layoutHandle = (ElasticsearchTableLayoutHandle) layout;
        ElasticsearchTableHandle tableHandle = layoutHandle.getTable();

//        // Call out to our client to retrieve all tablet split metadata using the row ID domain and the secondary index
        List<ElasticsearchSplit> tabletSplits = client.getTabletSplits(session, tableHandle, layoutHandle, splitSchedulingStrategy); //tableHandle.getSerializerInstance()

        // Pack the tablet split metadata into a connector split
        return new FixedSplitSource(tabletSplits);
    }
 
Example #5
Source File: KuduSplitManager.java    From presto-kudu with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectorSplitSource getSplits(ConnectorTransactionHandle transactionHandle,
                                      ConnectorSession session, ConnectorTableLayoutHandle layout,
                                      SplitSchedulingStrategy splitSchedulingStrategy) {
    KuduTableLayoutHandle layoutHandle = (KuduTableLayoutHandle) layout;

    List<KuduSplit> splits = clientSession.buildKuduSplits(layoutHandle);

    return new FixedSplitSource(splits);
}
 
Example #6
Source File: EthereumHandleResolver.java    From presto-ethereum with Apache License 2.0 4 votes vote down vote up
@Override
public Class<? extends ConnectorTableLayoutHandle> getTableLayoutHandleClass() {
    return EthereumTableLayoutHandle.class;
}
 
Example #7
Source File: KinesisMetadata.java    From presto-kinesis with Apache License 2.0 4 votes vote down vote up
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession connectorSession, ConnectorTableLayoutHandle connectorTableLayoutHandle)
{
    return new ConnectorTableLayout(connectorTableLayoutHandle);
}
 
Example #8
Source File: KinesisHandleResolver.java    From presto-kinesis with Apache License 2.0 4 votes vote down vote up
@Override
public Class<? extends ConnectorTableLayoutHandle> getTableLayoutHandleClass()
{
    return KinesisTableLayoutHandle.class;
}
 
Example #9
Source File: KuduHandleResolver.java    From presto-kudu with Apache License 2.0 4 votes vote down vote up
@Override
public Class<? extends ConnectorTableLayoutHandle> getTableLayoutHandleClass() {
    return KuduTableLayoutHandle.class;
}
 
Example #10
Source File: KuduMetadata.java    From presto-kudu with Apache License 2.0 4 votes vote down vote up
@Override
public boolean supportsMetadataDelete(ConnectorSession session, ConnectorTableHandle tableHandle,
                                      ConnectorTableLayoutHandle tableLayoutHandle) {
    return false;
}
 
Example #11
Source File: KuduMetadata.java    From presto-kudu with Apache License 2.0 4 votes vote down vote up
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle) {
    return new ConnectorTableLayout(handle);
}
 
Example #12
Source File: EthereumHandleResolver.java    From presto-ethereum with Apache License 2.0 4 votes vote down vote up
static EthereumTableLayoutHandle convertLayout(ConnectorTableLayoutHandle layout) {
    requireNonNull(layout, "layout is null");
    checkArgument(layout instanceof EthereumTableLayoutHandle, "layout is not an instance of EthereumTableLayoutHandle");
    return (EthereumTableLayoutHandle) layout;
}
 
Example #13
Source File: EthereumMetadata.java    From presto-ethereum with Apache License 2.0 4 votes vote down vote up
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle) {
    return new ConnectorTableLayout(handle);
}
 
Example #14
Source File: ParaflowHandleResolver.java    From paraflow with Apache License 2.0 4 votes vote down vote up
@Override
public Class<? extends ConnectorTableLayoutHandle> getTableLayoutHandleClass()
{
    return ParaflowTableLayoutHandle.class;
}
 
Example #15
Source File: ParaflowMetadata.java    From paraflow with Apache License 2.0 4 votes vote down vote up
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    ParaflowTableLayoutHandle layoutHandle = checkType(handle, ParaflowTableLayoutHandle.class, "tableLayoutHandle");
    return new ConnectorTableLayout(layoutHandle);
}
 
Example #16
Source File: HbaseMetadata.java    From presto-connectors with Apache License 2.0 4 votes vote down vote up
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    return new ConnectorTableLayout(handle);
}
 
Example #17
Source File: HbaseHandleResolver.java    From presto-connectors with Apache License 2.0 4 votes vote down vote up
@Override
public Class<? extends ConnectorTableLayoutHandle> getTableLayoutHandleClass()
{
    return HbaseTableLayoutHandle.class;
}
 
Example #18
Source File: ElasticsearchHandleResolver.java    From presto-connectors with Apache License 2.0 4 votes vote down vote up
@Override
public Class<? extends ConnectorTableLayoutHandle> getTableLayoutHandleClass()
{
    return ElasticsearchTableLayoutHandle.class;
}
 
Example #19
Source File: ElasticsearchMetadata.java    From presto-connectors with Apache License 2.0 4 votes vote down vote up
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
    return new ConnectorTableLayout(handle);
}