Search in sources :

Example 1 with TpchNodePartitioningProvider

use of io.trino.plugin.tpch.TpchNodePartitioningProvider in project trino by trinodb.

the class IndexedTpchConnectorFactory method create.

@Override
public Connector create(String catalogName, Map<String, String> properties, ConnectorContext context) {
    int splitsPerNode = getSplitsPerNode(properties);
    TpchIndexedData indexedData = new TpchIndexedData(indexSpec);
    NodeManager nodeManager = context.getNodeManager();
    return new Connector() {

        @Override
        public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) {
            return TpchTransactionHandle.INSTANCE;
        }

        @Override
        public ConnectorMetadata getMetadata(ConnectorSession session, ConnectorTransactionHandle transactionHandle) {
            return new TpchIndexMetadata(indexedData);
        }

        @Override
        public ConnectorSplitManager getSplitManager() {
            return new TpchSplitManager(nodeManager, splitsPerNode);
        }

        @Override
        public ConnectorRecordSetProvider getRecordSetProvider() {
            return new TpchRecordSetProvider(DecimalTypeMapping.DOUBLE);
        }

        @Override
        public ConnectorIndexProvider getIndexProvider() {
            return new TpchIndexProvider(indexedData);
        }

        @Override
        public Set<SystemTable> getSystemTables() {
            return ImmutableSet.of(new ExampleSystemTable());
        }

        @Override
        public ConnectorNodePartitioningProvider getNodePartitioningProvider() {
            return new TpchNodePartitioningProvider(nodeManager, splitsPerNode);
        }
    };
}
Also used : Connector(io.trino.spi.connector.Connector) IsolationLevel(io.trino.spi.transaction.IsolationLevel) ConnectorTransactionHandle(io.trino.spi.connector.ConnectorTransactionHandle) TpchSplitManager(io.trino.plugin.tpch.TpchSplitManager) NodeManager(io.trino.spi.NodeManager) TpchNodePartitioningProvider(io.trino.plugin.tpch.TpchNodePartitioningProvider) ConnectorSession(io.trino.spi.connector.ConnectorSession) SystemTable(io.trino.spi.connector.SystemTable) TpchRecordSetProvider(io.trino.plugin.tpch.TpchRecordSetProvider)

Aggregations

TpchNodePartitioningProvider (io.trino.plugin.tpch.TpchNodePartitioningProvider)1 TpchRecordSetProvider (io.trino.plugin.tpch.TpchRecordSetProvider)1 TpchSplitManager (io.trino.plugin.tpch.TpchSplitManager)1 NodeManager (io.trino.spi.NodeManager)1 Connector (io.trino.spi.connector.Connector)1 ConnectorSession (io.trino.spi.connector.ConnectorSession)1 ConnectorTransactionHandle (io.trino.spi.connector.ConnectorTransactionHandle)1 SystemTable (io.trino.spi.connector.SystemTable)1 IsolationLevel (io.trino.spi.transaction.IsolationLevel)1