Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.split;
import static com.facebook.presto.metadata.Util.toConnectorDomain;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
public class SplitManager
    private final SystemSplitManager systemSplitManager;
    @Inject
    public SplitManager(SystemSplitManager systemSplitManager)
    {
        this. = checkNotNull(systemSplitManager"systemSplitManager is null");
    }
    public void addConnectorSplitManager(String connectorIdConnectorSplitManager connectorSplitManager)
    {
        checkState(.putIfAbsent(connectorIdconnectorSplitManager) == null"SplitManager for connector '%s' is already registered"connectorId);
    }
    {
        TupleDomain<ColumnHandledomain = tupleDomain.orElse(TupleDomain.all());
        ConnectorPartitionResult result;
        if (domain.isNone()) {
            result = new ConnectorPartitionResult(ImmutableList.<ConnectorPartition>of(), toConnectorDomain(domain));
        }
        else {
            result = getConnectorSplitManager(table).getPartitions(table.getConnectorHandle(), toConnectorDomain(domain));
        }
        return new PartitionResult(table.getConnectorId(), result);
    }
    public SplitSource getPartitionSplits(TableHandle handleList<Partitionpartitions)
    {
        if (partitions.isEmpty()) {
            return new ConnectorAwareSplitSource(handle.getConnectorId(), new FixedSplitSource(handle.getConnectorId(), ImmutableList.<ConnectorSplit>of()));
        }
        ConnectorTableHandle table = handle.getConnectorHandle();
        ConnectorSplitSource source = getConnectorSplitManager(handle).getPartitionSplits(table, Lists.transform(partitions, Partition::getConnectorPartition));
        return new ConnectorAwareSplitSource(handle.getConnectorId(), source);
    }
    {
        String connectorId = handle.getConnectorId();
        if (connectorId.equals(.)) {
            return ;
        }
        ConnectorSplitManager result = .get(connectorId);
        checkArgument(result != null"No split manager for connector '%s'"connectorId);
        return result;
    }
New to GrepCode? Check out our FAQ X