Search in sources :

Example 1 with ConcatPageSource

use of io.trino.plugin.raptor.legacy.util.ConcatPageSource in project trino by trinodb.

the class RaptorPageSourceProvider method createPageSource.

@Override
public ConnectorPageSource createPageSource(ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorSplit split, ConnectorTableHandle table, List<ColumnHandle> columns, DynamicFilter dynamicFilter) {
    RaptorSplit raptorSplit = (RaptorSplit) split;
    RaptorTableHandle raptorTable = (RaptorTableHandle) table;
    OptionalInt bucketNumber = raptorSplit.getBucketNumber();
    TupleDomain<RaptorColumnHandle> predicate = raptorTable.getConstraint();
    OrcReaderOptions options = new OrcReaderOptions().withMaxMergeDistance(getReaderMaxMergeDistance(session)).withMaxBufferSize(getReaderMaxReadSize(session)).withStreamBufferSize(getReaderStreamBufferSize(session)).withTinyStripeThreshold(getReaderTinyStripeThreshold(session)).withLazyReadSmallRanges(isReaderLazyReadSmallRanges(session));
    OptionalLong transactionId = raptorSplit.getTransactionId();
    if (raptorSplit.getShardUuids().size() == 1) {
        UUID shardUuid = raptorSplit.getShardUuids().iterator().next();
        return createPageSource(shardUuid, bucketNumber, columns, predicate, options, transactionId);
    }
    Iterator<ConnectorPageSource> iterator = raptorSplit.getShardUuids().stream().map(shardUuid -> createPageSource(shardUuid, bucketNumber, columns, predicate, options, transactionId)).iterator();
    return new ConcatPageSource(iterator);
}
Also used : StorageManager(io.trino.plugin.raptor.legacy.storage.StorageManager) RaptorSessionProperties.getReaderTinyStripeThreshold(io.trino.plugin.raptor.legacy.RaptorSessionProperties.getReaderTinyStripeThreshold) Type(io.trino.spi.type.Type) OptionalInt(java.util.OptionalInt) ConcatPageSource(io.trino.plugin.raptor.legacy.util.ConcatPageSource) Inject(javax.inject.Inject) RaptorSessionProperties.getReaderStreamBufferSize(io.trino.plugin.raptor.legacy.RaptorSessionProperties.getReaderStreamBufferSize) OptionalLong(java.util.OptionalLong) OrcReaderOptions(io.trino.orc.OrcReaderOptions) ConnectorTableHandle(io.trino.spi.connector.ConnectorTableHandle) Objects.requireNonNull(java.util.Objects.requireNonNull) ColumnHandle(io.trino.spi.connector.ColumnHandle) ConnectorPageSource(io.trino.spi.connector.ConnectorPageSource) RaptorSessionProperties.isReaderLazyReadSmallRanges(io.trino.plugin.raptor.legacy.RaptorSessionProperties.isReaderLazyReadSmallRanges) Iterator(java.util.Iterator) RaptorSessionProperties.getReaderMaxMergeDistance(io.trino.plugin.raptor.legacy.RaptorSessionProperties.getReaderMaxMergeDistance) ConnectorSplit(io.trino.spi.connector.ConnectorSplit) ConnectorPageSourceProvider(io.trino.spi.connector.ConnectorPageSourceProvider) ConnectorSession(io.trino.spi.connector.ConnectorSession) UUID(java.util.UUID) RaptorSessionProperties.getReaderMaxReadSize(io.trino.plugin.raptor.legacy.RaptorSessionProperties.getReaderMaxReadSize) TupleDomain(io.trino.spi.predicate.TupleDomain) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) DynamicFilter(io.trino.spi.connector.DynamicFilter) ConnectorTransactionHandle(io.trino.spi.connector.ConnectorTransactionHandle) ConcatPageSource(io.trino.plugin.raptor.legacy.util.ConcatPageSource) OrcReaderOptions(io.trino.orc.OrcReaderOptions) OptionalLong(java.util.OptionalLong) OptionalInt(java.util.OptionalInt) UUID(java.util.UUID) ConnectorPageSource(io.trino.spi.connector.ConnectorPageSource)

Aggregations

OrcReaderOptions (io.trino.orc.OrcReaderOptions)1 RaptorSessionProperties.getReaderMaxMergeDistance (io.trino.plugin.raptor.legacy.RaptorSessionProperties.getReaderMaxMergeDistance)1 RaptorSessionProperties.getReaderMaxReadSize (io.trino.plugin.raptor.legacy.RaptorSessionProperties.getReaderMaxReadSize)1 RaptorSessionProperties.getReaderStreamBufferSize (io.trino.plugin.raptor.legacy.RaptorSessionProperties.getReaderStreamBufferSize)1 RaptorSessionProperties.getReaderTinyStripeThreshold (io.trino.plugin.raptor.legacy.RaptorSessionProperties.getReaderTinyStripeThreshold)1 RaptorSessionProperties.isReaderLazyReadSmallRanges (io.trino.plugin.raptor.legacy.RaptorSessionProperties.isReaderLazyReadSmallRanges)1 StorageManager (io.trino.plugin.raptor.legacy.storage.StorageManager)1 ConcatPageSource (io.trino.plugin.raptor.legacy.util.ConcatPageSource)1 ColumnHandle (io.trino.spi.connector.ColumnHandle)1 ConnectorPageSource (io.trino.spi.connector.ConnectorPageSource)1 ConnectorPageSourceProvider (io.trino.spi.connector.ConnectorPageSourceProvider)1 ConnectorSession (io.trino.spi.connector.ConnectorSession)1 ConnectorSplit (io.trino.spi.connector.ConnectorSplit)1 ConnectorTableHandle (io.trino.spi.connector.ConnectorTableHandle)1 ConnectorTransactionHandle (io.trino.spi.connector.ConnectorTransactionHandle)1 DynamicFilter (io.trino.spi.connector.DynamicFilter)1 TupleDomain (io.trino.spi.predicate.TupleDomain)1 Type (io.trino.spi.type.Type)1 Iterator (java.util.Iterator)1 List (java.util.List)1