Search in sources :

Example 1 with ConnectorSplitBatch

use of io.trino.spi.connector.ConnectorSplitSource.ConnectorSplitBatch in project trino by trinodb.

the class TestBackgroundHiveSplitLoader method drainSplits.

private static List<HiveSplit> drainSplits(HiveSplitSource source) throws Exception {
    ImmutableList.Builder<HiveSplit> splits = ImmutableList.builder();
    while (!source.isFinished()) {
        ConnectorSplitBatch batch;
        try {
            batch = source.getNextBatch(NOT_PARTITIONED, 100).get();
        } catch (ExecutionException e) {
            throwIfUnchecked(e.getCause());
            throw e;
        }
        batch.getSplits().stream().map(HiveSplit.class::cast).forEach(splits::add);
    }
    return splits.build();
}
Also used : ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) ImmutableList(com.google.common.collect.ImmutableList) ConnectorSplitBatch(io.trino.spi.connector.ConnectorSplitSource.ConnectorSplitBatch) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)1 ConnectorSplitBatch (io.trino.spi.connector.ConnectorSplitSource.ConnectorSplitBatch)1 ExecutionException (java.util.concurrent.ExecutionException)1